Esempio n. 1
0
function mailSend($from, $to, $subject = 'no subject', $message = 'no message', $encoding = "utf-8", $debug = false)
{
    //CModule::IncludeModule("iblock");
    //$to = "*****@*****.**";
    //$from = "*****@*****.**";
    //$subject = "test";
    //$message = "Test message! - 1";
    //$additionalHeaders = 'From: ' . $from . "\r\n";
    $additionalHeaders = 'MIME-Version: 1.0' . "\r\n";
    $additionalHeaders .= 'Content-Type: text/html; charset=' . $encoding . '; format=flowed' . "\r\n";
    $additionalHeaders .= 'Content-Transfer-Encoding: 8Bit' . "\r\n";
    $additionalHeaders .= 'From: ' . $from . "";
    custom_mail($to, $subject, $message, $additionalHeaders, true);
}
Esempio n. 2
0
 $mail_subject = _T("Your Galette identifiers");
 $mail_text = _T("Hello,") . "\n";
 $mail_text .= "\n";
 $mail_text .= _T("Someone (probably you) asked to recover your password.") . "\n";
 $mail_text .= "\n";
 $mail_text .= _T("Please login at this address to set your new password :"******"\n";
 $mail_text .= HTTP . "://" . $_SERVER["SERVER_NAME"] . dirname($_SERVER["REQUEST_URI"]) . "/change_passwd.php?hash={$hash}\n";
 $mail_text .= "\n";
 //$mail_text .= _T("Username:"******" ".custom_html_entity_decode($login_adh, ENT_QUOTES)."\n";
 //$mail_text .= _T("Temporary password:"******" ".custom_html_entity_decode($hash, ENT_QUOTES)."\n";
 //$mail_text .= "\n";
 $mail_text .= _T("See you soon!") . "\n";
 $mail_text .= "\n";
 $mail_text .= _T("(this mail was sent automatically)") . "\n";
 //$mail_headers = "From: ".PREF_EMAIL_NOM." <".PREF_EMAIL.">\n";
 $mail_result = custom_mail($email_adh, $mail_subject, $mail_text);
 if ($mail_result == 1) {
     dblog("Password sent. Login:"******" \"" . $login_adh . "\"");
     $warning_detected = _T("Password sent. Login:"******" \"" . $login_adh . "\"";
     //$password_sent = true;
 } else {
     switch ($mail_result) {
         case 2:
             dblog("Email sent is disabled in the preferences");
             $warning_detected = _T("Email sent is disabled in the preferences. Ask galette admin");
             break;
         case 3:
             dblog("A problem happened while sending password for account:" . " \"" . $login_adh . "\"");
             $warning_detected = _T("A problem happened while sending password for account:") . " \"" . $login_adh . "\"";
             break;
         case 4:
Esempio n. 3
0
function bxmail($to, $subject, $message, $additional_headers="", $additional_parameters="")
{
	if(function_exists("custom_mail"))
		return custom_mail($to, $subject, $message, $additional_headers, $additional_parameters);

	if($additional_parameters!="")
		return @mail($to, $subject, $message, $additional_headers, $additional_parameters);

	return @mail($to, $subject, $message, $additional_headers);
}
 $mail_text .= _T("You've just been subscribed on the members management system of the association.") . "\n";
 $mail_text .= _T("It is now possible to follow in real time the state of your subscription") . "\n";
 $mail_text .= _T("and to update your preferences from the web interface.") . "\n";
 $mail_text .= "\n";
 $mail_text .= _T("Please login at this address:") . "\n";
 $mail_text .= "http://" . $_SERVER["SERVER_NAME"] . dirname($_SERVER["REQUEST_URI"]) . "\n";
 $mail_text .= "\n";
 $mail_text .= _T("Username:"******" " . custom_html_entity_decode($adherent['login_adh']) . "\n";
 $mail_text .= _T("Password:"******" " . custom_html_entity_decode($adherent['mdp_adh_plain']) . "\n";
 $mail_text .= "\n";
 $mail_text .= _T("See you soon!") . "\n";
 $mail_text .= "\n";
 $mail_text .= _T("(this mail was sent automatically)") . "\n";
 /** For debug **/
 //echo "mail content (send to ".$_POST['email_adh']." with subject '".$mail_subject."') will be :<br />".$mail_text."<br />";
 $mail_result = custom_mail($_POST['email_adh'], $mail_subject, $mail_text);
 /** TODO
  * Send email to admin(s?) to inform a new account has been created.
  * Btw, emailing admin(s?) should be added in the preferences
  */
 if ($mail_result == 1) {
     //check if mail was successfully send
     dblog("Self subscribe - Send subscription mail to:" . $adherent["email_adh"], $requete);
     $warning_detected[] = _T("Password sent. Login:"******" \"" . $adherent["login_adh"] . "\"";
 } else {
     //warn user if not
     switch ($mail_result) {
         case 2:
             dblog("Self subscribe - Email sent is disabled in the preferences. Ask galette admin.");
             $warning_detected[] = _T("Email sent is disabled in the preferences. Ask galette admin.");
             break;
 $mail_text = _T("Hello,") . "\n";
 $mail_text .= "\n";
 $mail_text .= _T("You've just been subscribed on the members management system of the association.") . "\n";
 $mail_text .= _T("It is now possible to follow in real time the state of your subscription") . "\n";
 $mail_text .= _T("and to update your preferences from the web interface.") . "\n";
 $mail_text .= "\n";
 $mail_text .= _T("Please login at this address:") . "\n";
 $mail_text .= "http://" . $_SERVER["SERVER_NAME"] . dirname($_SERVER["REQUEST_URI"]) . "\n";
 $mail_text .= "\n";
 $mail_text .= _T("Username:"******" " . custom_html_entity_decode($adherent['login_adh']) . "\n";
 $mail_text .= _T("Password:"******" " . custom_html_entity_decode($adherent['mdp_adh']) . "\n";
 $mail_text .= "\n";
 $mail_text .= _T("See you soon!") . "\n";
 $mail_text .= "\n";
 $mail_text .= _T("(this mail was sent automatically)") . "\n";
 $mail_result = custom_mail($adherent['email_adh'], $mail_subject, $mail_text);
 //TODO: duplicate piece of code with mailing_adherent
 if ($mail_result == 1) {
     dblog("Send subscription mail to :" . $_POST["email_adh"], $requete);
     $warning_detected[] = _T("Password sent. Login:"******" \"" . $adherent['login_adh'] . "\"";
     //$password_sent = true;
 } else {
     switch ($mail_result) {
         case 2:
             dblog("Email sent is disabled in the preferences. Ask galette admin.");
             $error_detected[] = _T("Email sent is disabled in the preferences. Ask galette admin");
             break;
         case 3:
             dblog("A problem happened while sending password for account:" . " \"" . $_POST["email_adh"] . "\"");
             $error_detected[] = _T("A problem happened while sending password for account:") . " \"" . $_POST["email_adh"] . "\"";
             break;
 foreach ($reachable_members as $id_adh) {
     $member_id_string .= $id_adh . ",";
 }
 $member_id_string = substr($member_id_string, 0, -1);
 // TODO : interpret cutom tags to include personal data in mails
 $sql = "SELECT id_adh, email_adh, nom_adh, prenom_adh\n\t\t\t\t\t\tFROM " . PREFIX_DB . "adherents\n\t\t\t\t\t\tWHERE id_adh IN ({$member_id_string})";
 $result_members =& $DB->Execute($sql);
 if ($data['mailing_html'] == 0) {
     $content_type = "text/plain";
 } else {
     $content_type = "text/html";
 }
 $mail_result = "";
 $email_adh = "";
 while (!$result_members->EOF) {
     $mail_result = custom_mail($result_members->fields[1], $data['mailing_objet'], $data['mailing_corps'], $content_type);
     if ($mail_result == 1) {
         $email_adh = $result_members->fields[1];
         dblog("Send mail to :" . " \"" . $email_adh . "\"", $sql);
         $warning_detected[] = _T("Mail sent to :") . " \"" . $email_adh . "\"";
     } else {
         switch ($mail_result) {
             case 2:
                 dblog("Email sent is disabled in the preferences. Ask galette admin.");
                 $error_detected[] = _T("Email sent is disabled in the preferences. Ask galette admin");
                 break;
             case 3:
                 dblog("A problem happened while sending mail to :" . " \"" . $email_adh . "\"");
                 $error_detected[] = _T("A problem happened while sending mail to :") . " \"" . $email_adh . "\"";
                 break;
             case 4: