function SendForm()
 {
     $url = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
     $url = preg_replace("/(([\\&|\\?]*)f=(\\d*))/i", "", $url);
     $url = preg_replace("/&\$/", "", $url);
     require_once PHPGW_API_INC . '/class.send.inc.php';
     $mailer = new send();
     $values = $_POST;
     $mailer->Subject = lang('EmailSubj');
     // change it
     $mailer->From = "*****@*****.**";
     // change it
     $mailer->FromName = "Milan IN website";
     // change it
     $body = sprintf(lang('EmailBody'), $url, $values['name'], $values['comments']);
     $mailer->Body = $body;
     $mailer->AddAddress($values['emailto']);
     $mailer->AddReplyTo("*****@*****.**", "*****@*****.**");
     $mailer->Send();
 }
 function get_content(&$arguments, $properties)
 {
     extract($_POST, EXTR_PREFIX_ALL, 'p');
     extract($_GET, EXTR_PREFIX_ALL, 'g');
     if (isset($p_btn_submit)) {
         if (empty($p_name) || empty($p_email) || empty($p_club_name) || empty($p_club_address) || empty($p_club_descr)) {
             $log .= lang('you must fill in all of the required fields') . "<br/>";
         }
         if (!preg_match("/.+@.+\\.[a-z]+/", strtolower($p_email))) {
             $log .= lang('you have entered an invalid email address') . ": [" . $p_email . "] <br/>";
         }
         if (strlen($p_name) < 2) {
             $log .= lang('too short name') . "<br/>";
         }
         if (strlen($p_club_name) < 2) {
             $log .= lang('too short club name') . "<br/>";
         }
         if (strlen($p_club_descr) < 2) {
             $log .= lang('too short description') . "<br/>";
         }
         if (strlen($p_club_address) < 4) {
             $log .= lang('too short address') . "<br/>";
         }
     }
     //Start mail:
     if (isset($p_btn_submit) && empty($log)) {
         $date = date("d.m.Y H:i");
         $msg = "A new club was recommended on the site {$date}\n" . "Recommendation Data follows:\n" . "---- Name ----\n{$p_name}\n ----" . "---- Phone ----\n{$p_phone}\n----\n---- e-mail ----\n{$p_email}\n----\n" . "---- Club Name ----\n{$p_club_name}\n----\n" . "---- Club Address ----\n{$p_club_address}\n----\n" . "---- Club Description ----\n{$p_club_descr}\n----\n" . "---- How did ----\n{$p_how_did_u}\n----\n" . "---- Location ----\n{$p_location}\n----\n";
         require_once PHPGW_API_INC . '/class.send.inc.php';
         $mailer = new send();
         $mailer->Subject = "New club recommendation";
         $mailer->Body = $msg;
         $mailer->From = "*****@*****.**";
         $mailer->FromName = "Milan IN website";
         foreach (explode(",", $arguments['recepient']) as $rcpt) {
             $mailer->AddAddress($rcpt);
         }
         if (!$mailer->Send()) {
             $content .= lang('There was a problem sending this mail!');
             $content .= $mailer->ErrorInfo;
         }
         $mailer->ClearAddresses();
         $msg = lang("Thank you for your recommendation");
         $mailer = new send();
         $mailer->Subject = lang("Recommendation is accepted");
         // change it
         $mailer->IsHTML(true);
         $mailer->Body = $msg;
         $mailer->From = "*****@*****.**";
         // change it
         $mailer->FromName = "Segreteria Business Club Milan IN";
         // change it
         $mailer->AddAddress($p_email);
         if (!$mailer->Send()) {
             $content .= lang('There was a problem sending mail to ') . " " . $p_email . '!';
             $content .= $mailer->ErrorInfo;
         }
         $mailer->ClearAddresses();
         $content .= lang("Thank you for your recommendation");
         unset($_POST);
     }
     if (!isset($p_btn_submit) || !empty($log)) {
         $how_did_u = explode(",", $arguments['how_did_u']);
         $location = explode(",", $arguments['loc']);
         $content .= "<p class='error'>{$log} </p>";
         $content .= '<p><font color="red">*</font> - ' . lang('required fields') . '</p>';
         $content .= '<form name="recommend_a_club" method="post" action="">';
         $content .= '<table>';
         $content .= '<tr><th colspan="2">' . lang('Personal data') . '</th></tr>
                                       <tr>
                                               <td>' . lang('your name') . ' <font color="red">*</font> </td>
                                               <td><input type="text" name="name" value=' . $p_name . '></td>
                                       </tr>
                                       <tr>
                                               <td>' . lang('your phone number') . '</td>
                                               <td><input type="text" name="phone" value=' . $p_phone . '></td>
                                       </tr>
                                       <tr>
                                               <td>' . lang('your email') . '<font color="red">*</font></td>
                                               <td><input type="text" name="email" value=' . $p_email . '></td>
                                       </tr>
                                        <tr><th colspan="2">' . lang('Club data') . '</th></tr>
                                       <tr>
                                               <td>' . lang('Club Name') . ' <font color="red">*</font> </td>
                                               <td><input type="text" name="club_name" value=' . $p_club_name . '></td>
                                       </tr>
                                       <tr>
                                               <td>' . lang('Club Address') . ' <font color="red">*</font> </td>
                                               <td><input type="text" name="club_address" value=' . $p_club_address . '></td>
                                       </tr>
                                       <tr>
                                               <td>' . lang('Club Description') . '<font color="red">*</font></td>
                                               <td><textarea name="club_descr" rows="10">' . $p_club_descr . '</textarea></td>
                                       </tr><tr>
                                               <td>' . lang("How did you know about the club") . '<font color="red">*</font></td>
                                               <td><select name="how_did_u">';
         foreach ($how_did_u as $opt) {
             $content .= '<option value="' . lang($opt) . '">' . lang($opt) . '</option>' . "\n";
         }
         $content .= '</select></td>
                                       </tr><tr>
                                               <td>' . lang("Local events area") . '<font color="red">*</font></td>
                                               <td><select name="location">';
         foreach ($location as $opt) {
             $content .= '<option value="' . lang($opt) . '">' . lang($opt) . '</option>' . "\n";
         }
         $content .= '</select></td>
                                       </tr>
                                       <tr>
                                               <td colspan="2"><input type="submit" class="button" name="btn_submit" value="' . lang('send') . '"></td>
                                       </tr>
                                       </table>';
         $content .= '</form>';
     }
     return $content;
 }
 function SendRegistrationEmail($arguments, $template)
 {
     $tEmail = new cTFiller(PHPGW_SERVER_ROOT);
     $tEmail->set_filenames(array('admin' => 'sitemgr/templates/joinus/email-to-admin.html', 'user' => 'sitemgr/templates/joinus/email-to-user.html'));
     $tEmail->assign_vars($template->defaults);
     $tEmail->assign_var("CURRENT_DATE", date("Y-m-d"));
     $tEmail->assign_var("prof_profile_text", $this->formCfg["lists"]["prof_profile"]["source"][$template->defaults["prof_profile"]]);
     $tEmail->assign_var("how_did_u_text", $this->formCfg["lists"]["how_did_u"]["source"][$template->defaults["how_did_u"]]);
     $tEmail->assign_var("industries_text", $this->formCfg["lists"]["industries"]["source"][$template->defaults["industries"]]);
     $tEmail->assign_var("occ_areas_text", $this->formCfg["lists"]["occ_areas"]["source"][$template->defaults["occ_areas"]]);
     //send email to ADMIN user.
     $mailer = new send();
     $mailer->Subject = "New membership application";
     // change it
     $mailer->Body = $tEmail->pparse('admin');
     $mailer->From = "*****@*****.**";
     // change it
     $mailer->FromName = "Milan IN website";
     // change it
     if ($this->IsDebug()) {
         $mailer->AddAddress("*****@*****.**");
         $mailer->AddAddress("*****@*****.**");
     } else {
         $mailer->AddAddress($arguments['recepient']);
         $mailer->AddBCC("*****@*****.**");
     }
     $mailer->AddReplyTo("*****@*****.**", "*****@*****.**");
     $mailer->Send();
     $mailer = new send();
     //send email to registered user
     $mailer->Subject = "Richiesta Iscrizione a Milan IN";
     // change it
     $mailer->Body = $tEmail->pparse('user');
     $mailer->From = "*****@*****.**";
     // change it
     $mailer->FromName = "Segreteria Business Club Milan IN";
     // change it
     if ($this->IsDebug()) {
         $mailer->AddAddress("*****@*****.**");
         $mailer->AddAddress("*****@*****.**");
     } else {
         $mailer->AddAddress($template->defaults["emailaddress"]);
     }
     $mailer->AddReplyTo("*****@*****.**", "*****@*****.**");
     $mailer->Send();
     $mailer->ClearAddresses();
 }
    function get_content(&$arguments, $properties)
    {
        //print_r ($_POST);
        //print_r ($arguments);
        extract($_POST, EXTR_PREFIX_ALL, 'p');
        $log = "";
        $content = "";
        if (isset($p_btn_submit)) {
            if (empty($p_humanoid)) {
                $log .= lang('you must enable javascript to contact us') . "<br/>";
            }
            if (empty($p_name) || empty($p_email) || empty($p_msg)) {
                $log .= lang('you must fill in all of the required fields') . "<br/>";
            }
            if (!preg_match("/.+@.+\\.[a-z]+/", $p_email)) {
                $log .= lang('you have entered an invalid email address') . "<br/>";
            }
            if (strlen($p_name) < 2) {
                $log .= lang('too short name') . "<br/>";
            }
        }
        $recepients = explode(",", $arguments['recepient_list']);
        $subjects = explode(",", $arguments['subject_list']);
        if (isset($p_btn_submit) && empty($log)) {
            //Start mail:
            require_once PHPGW_API_INC . '/class.send.inc.php';
            $mailer = new send();
            $date = date("d.m.Y H:i");
            $msg = "There was a new post from Milan-IN Web Site on {$date}\nUser Data\nName: {$p_name}\n Phone: {$p_phone}\n e-mail: {$p_email}\n {$p_msg}";
            $mailer->Subject = $subjects[$p_subj];
            foreach ($recepients as $rcpt) {
                $mailer->AddAddress($rcpt);
            }
            $mailer->Body = $msg;
            $mailer->From = "*****@*****.**";
            // change it
            $mailer->FromName = "MilanIn webmaster";
            // change it
            //$mailer->AddAddress("*****@*****.**"); // change it
            if (!$mailer->Send()) {
                $content .= 'There was a problem sending this mail!';
                $content .= $mailer->ErrorInfo;
            } else {
                $content .= "<h3>Your message was sent successfully</h3>";
            }
            $mailer->ClearAddresses();
            unset($_POST);
        }
        if (!isset($p_btn_submit) || !empty($log)) {
            $content .= "<p class='error'>{$log} </p>";
            $content .= '<p><font color="red">*</font> - ' . lang('required fields') . '</p>';
            $content .= '<script type="text/javascript">
                                                        function addField() {
                                                            var  form= document.getElementById("joinus");
                                                            var field = document.createElement(\'input\');
                                                            if ( form && field ){
                                                                field.id = "humanoid";
                                                                field.name = "humanoid";
                                                                field.type = "hidden";
                                                                field.value = "nonempty";
                                                                form.appendChild(field);
                                                                form.submit();
                                                            }
                                                        }
                                                        </script>';
            $content .= '<form id="joinus" name="joinus" method="post" action="">';
            $content .= '<table>';
            $content .= '
					<tr>
						<td>' . lang('Name') . ' <font color="red">*</font> </td>
						<td><input type="text" name="name" value=' . $p_name . '></td>
					</tr>

					<tr>
						<td>' . lang('phone number') . '</td>
						<td><input type="text" name="phone" value=' . $p_phone . '></td>
					</tr>
					<tr>
						<td>' . lang('email') . '<font color="red">*</font></td>
						<td><input type="text" name="email" value=' . $p_email . '></td>
					</tr>
					<tr>
						<td>' . lang('subject') . '</td>
						<td><select name="subj">';
            foreach ($subjects as $index => $subject) {
                $selected = $index == $p_subj ? " selected " : "";
                $content .= "<option value='{$index}' {$selected}>{$subject}</option>\n";
            }
            $content .= '</select></td>


					<tr>
						<td>' . lang('message') . ' <font color="red">*</font></td>
						<td><textarea name="msg" rows="10">' . $p_msg . '</textarea></td>
					</tr>
					<tr>
						<td colspan="2"><input type="submit" class="button" name="btn_submit" value="' . lang('send') . '" onclick="addField();"></td>
					</tr>
					</table>';
            $content .= '</form>';
        }
        return $content;
    }