if (DEBUG_SMTP) { $email_obj->smtp_debug = 1; $email_obj->smtp_html_debug = 0; } else { $email_obj->smtp_debug = 0; $email_obj->smtp_html_debug = 0; } $email_obj->SetBulkMail = 1; $email_obj->mailer = TM_APPTEXT; $email_obj->SetEncodedEmailHeader("From", $HOST[0]['sender_email'], $HOST[0]['sender_name']); $email_obj->SetEncodedEmailHeader("Reply-To", $HOST[0]['reply_to'], $HOST[0]['sender_name']); $email_obj->SetHeader("Return-Path", $HOST[0]['return_mail']); $email_obj->SetEncodedEmailHeader("Errors-To", $HOST[0]['return_mail'], $HOST[0]['return_mail']); //set additional headers //list unsubscribe! $email_obj->SetEncodedHeader("List-Unsubscribe", $tm_URL_FE . "/unsubscribe.php"); //date $email_obj->SetEncodedHeader("X-TM_DATE", date("Y-m-d H:i:s")); //mark massmails $email_obj->SetEncodedHeader("X-TM_MASSMAIL", $NL[0]['massmail']); //queue id $email_obj->SetHeader("X-TM_QID", $Q[$qcc]['id']); //newsletter id $email_obj->SetHeader("X-TM_NLID", $NL[0]['id']); //adr grp id $email_obj->SetHeader("X-TM_GRPID", $Q[$qcc]['grp_id']); //H holen //Sendeliste Eintraege die versendet werden duerfen, also kein fehler etc, nur 'neu' , status 1 //limit $max_mails_atonce //nur fuer gewahlte Q, achtung: dadurch muessen wir nl nur einmal holen und auslesen!!! //ansonsten muesste man jedesmal nl holen aus hist. nl_id
function send_smtp_email($mail_row) { $to_name = html_ent_to_utf8($mail_row['to_name']); $to_address = $mail_row['to_address']; $from_name = html_ent_to_utf8($mail_row['from_name']); $from_address = $mail_row['from_address']; $subject = html_ent_to_utf8($mail_row['subject']); $message = html_ent_to_utf8($mail_row['message']); $html_message = html_ent_to_utf8($mail_row['html_message']); //$html_message = $mail_row['html_message']; $email_message = new smtp_message_class(); $dir = dirname(__FILE__); $dir = preg_split('%[/\\\\]%', $dir); $blank = array_pop($dir); $dir = implode('/', $dir); if (!class_exists("sasl_client_class")) { require "{$dir}/mail/sasl/sasl.php"; } $email_message->localhost = EMAIL_HOSTNAME; $email_message->smtp_host = EMAIL_SMTP_SERVER; $email_message->smtp_direct_delivery = 0; $email_message->smtp_exclude_address = ""; $email_message->smtp_user = EMAIL_SMTP_USER; $email_message->smtp_realm = ""; $email_message->smtp_password = EMAIL_SMTP_PASS; $email_message->smtp_pop3_auth_host = EMAIL_SMTP_AUTH_HOST; $email_message->smtp_ssl = 0; $email_message->authentication_mechanism = 'USER'; // SASL authentication if (EMAIL_DEBUG_SWITCH == 'YES') { $email_message->smtp_debug = 1; } else { $email_message->smtp_debug = 0; } $email_message->smtp_html_debug = 0; //echo "[$to_address], [$to_name], [$from_address], [$from_name], [$subject], [$message], [$html_messageaz]"; $reply_address = $mail_row['from_address']; $error_delivery_name = SITE_NAME; $error_delivery_address = SITE_CONTACT_EMAIL; //$message="Hello ".strtok($to_name," ").",\n\nThis message is just to let you know that your e-mail sending class is working as expected.\n\nHere's some non-ASCII characters ÁèÎõÜ in the message body to let you see if they are sent properly encoded.\n\nThank you,\n$from_name"; //$email_message=new email_message_class; $email_message->default_charset = 'UTF-8'; $email_message->SetEncodedEmailHeader("To", $to_address, $to_name); $email_message->SetEncodedEmailHeader("From", $from_address, $from_name); $email_message->SetEncodedEmailHeader("Reply-To", $reply_address, $reply_name); /* Set the Return-Path header to define the envelope sender address to which bounced messages are delivered. If you are using Windows, you need to use the smtp_message_class to set the return-path address. */ if (defined("PHP_OS") && strcmp(substr(PHP_OS, 0, 3), "WIN")) { $email_message->SetHeader("Return-Path", $error_delivery_address); } $email_message->SetEncodedEmailHeader("Errors-To", $error_delivery_address, $error_delivery_name); $email_message->SetEncodedHeader("Subject", $subject); if ($html_message == '') { // ONLY TEXT $email_message->AddQuotedPrintableTextPart($email_message->WrapText($message)); } else { $email_message->CreateQuotedPrintableHTMLPart($html_message, "", $html_part); //$text_message="This is an HTML message. Please use an HTML capable mail program to read this message."; $email_message->CreateQuotedPrintableTextPart($email_message->WrapText($message), "", $text_part); $alternative_parts = array($html_part, $text_part); $email_message->AddAlternativeMultipart($alternative_parts); } if ($mail_row[attachments] == 'Y') { add_mail_attachments($email_message, $mail_row); } $error = $email_message->Send(); if (strcmp($error, "")) { //echo "Error: $error\n"; $now = gmdate("Y-m-d H:i:s"); $sql = "UPDATE mail_queue SET status='error', retry_count=retry_count+1, error_msg='" . addslashes($error) . "', `date_stamp`='{$now}' WHERE mail_id=" . $mail_row['mail_id']; //echo $sql; mysql_query($sql) or q_mail_error(mysql_error() . $sql); } else { $now = gmdate("Y-m-d H:i:s"); $sql = "UPDATE mail_queue SET status='sent', `date_stamp`='{$now}' WHERE mail_id=" . $mail_row['mail_id']; mysql_query($sql) or q_mail_error(mysql_error() . $sql); //echo $sql; } //echo "."; }
function SendMail_smtp($from_address, $from_name, $to_address, $to_name, $subject, $text, $html, $AttmFiles = array(), $HOST = array()) { global $encoding, $tm_URL_FE; //use default encoding $return = false; if (!isset($HOST[0])) { $HOSTS = new tm_HOST(); $HOST = $HOSTS->getStdSMTPHost(); } //using http://www.phpclasses.org/trackback/browse/package/9.html http://www.phpclasses.org/browse/package/14.html http://www.phpclasses.org/trackback/browse/package/14.html //Class: MIME E-mail message composing and sending //thx to Manuel Lemos <mlemos at acm dot org> //look at: http://freshmeat.net/projects/mimemessageclass/ require_once "Class_SMTP.inc.php"; $email_message = new smtp_message_class(); $email_message->default_charset = $encoding; $email_message->authentication_mechanism = $HOST[0]['smtp_auth']; /* This computer address */ $email_message->localhost = $HOST[0]['smtp_domain']; $email_message->ssl = $HOST[0]['smtp_ssl']; /* SMTP server address, probably your ISP address */ $email_message->smtp_host = $HOST[0]['host']; $email_message->smtp_port = $HOST[0]['port']; /* authentication user name */ $email_message->smtp_user = $HOST[0]['user']; /* authentication realm or Windows domain when using NTLM authentication */ $email_message->smtp_realm = ""; /* authentication workstation name when using NTLM authentication */ $email_message->smtp_workstation = ""; /* authentication password */ $email_message->smtp_password = $HOST[0]['pass']; /* if you need POP3 authetntication before SMTP delivery, * specify the host name here. The smtp_user and smtp_password above * should set to the POP3 user and password*/ $email_message->smtp_pop3_auth_host = ""; /* Output dialog with SMTP server */ $email_message->smtp_html_debug = 0; /* if smtp_debug is 1, * set this to 1 to make the debug output appear in HTML */ if (DEBUG_SMTP) { $email_message->smtp_debug = 1; } else { $email_message->smtp_debug = 0; $email_message->smtp_html_debug = 0; } $email_message->maximum_piped_recipients = $HOST[0]['smtp_max_piped_rcpt']; //sends only XX rcpt to before waiting for ok from server! $email_message->mailer = TM_APPTEXT . " using smtp"; $email_message->SetEncodedEmailHeader("To", $to_address, $to_name); $email_message->SetEncodedEmailHeader("From", $HOST[0]['sender_email'], $HOST[0]['sender_name']); $email_message->SetEncodedEmailHeader("Reply-To", $HOST[0]['reply_to'], $HOST[0]['sender_name']); $email_message->SetHeader("Return-Path", $HOST[0]['return_mail']); $email_message->SetEncodedEmailHeader("Errors-To", $HOST[0]['return_mail'], $HOST[0]['sender_name']); $email_message->SetEncodedHeader("List-Unsubscribe", $tm_URL_FE . "/unsubscribe.php"); $email_message->SetEncodedHeader("Subject", $subject); $partids = array(); //array of partnumbers, returned by reference from createpart etc //we want mixed multipart, with alternative text/html and attachements, inlineimages and all that //text part must be the first one!!! //only add part $email_message->CreateQuotedPrintableTextPart($text, "", $partids[]); $email_message->CreateQuotedPrintableHtmlPart($html, "", $partids[]); //AddAlternativeMultiparts $email_message->AddAlternativeMultipart($partids); //attachements //filenames stored in Array $AttmFiles if ($AttmFiles) { foreach ($AttmFiles as $AttmFile) { $attachment = array("FileName" => $AbsPath . "/" . $AttmFile, "Content-Type" => "automatic/name", "Disposition" => "attachment"); $email_message->AddFilePart($attachment); } //for each } //ifAttmFiles $error = $email_message->Send(); for ($recipient = 0, Reset($email_message->invalid_recipients); $recipient < count($email_message->invalid_recipients); Next($email_message->invalid_recipients), $recipient++) { echo "Invalid recipient: ", Key($email_message->invalid_recipients), " Error: ", $email_message->invalid_recipients[Key($email_message->invalid_recipients)], "\n"; } if (strcmp($error, "")) { $return[0] = false; $return[1] = $error; } if (empty($error)) { $return[0] = true; $return[1] = ""; } return $return; }
function sendmail($mail_from, $mail_to, $mail_subject = "", $mail_body = "") { global $apps_path; if (!class_exists(email_message_class)) { include_once $apps_path[libs] . "/gpl/mimemessage/email_message.php"; } if (!class_exists(smtp_message_class)) { include_once $apps_path[libs] . "/gpl/mimemessage/smtp_message.php"; } if (!class_exists(smtp_class)) { include_once $apps_path[libs] . "/gpl/mimemessage/smtp/smtp.php"; } $from_name = ""; $from_address = $mail_from; $reply_name = $from_name; $reply_address = $from_address; $error_delivery_name = $from_name; $error_delivery_address = $from_address; $to_name = ""; $to_address = $mail_to; $cc_name = ""; $cc_address = ""; $bcc_name = ""; $bcc_address = ""; $subject = $mail_subject; $text_message = $mail_body; $email_message = new smtp_message_class(); $email_message->localhost = "localhost"; $email_message->smtp_realm = _SMTP_RELM_; $email_message->smtp_user = _SMTP_USER_; $email_message->smtp_password = _SMTP_PASS_; $email_message->smtp_host = _SMTP_HOST_; $email_message->smtp_port = _SMTP_PORT_; $email_message->smtp_debug = 0; $email_message->smtp_direct_delivery = 0; $email_message->SetEncodedEmailHeader("To", $to_address, $to_name); if ($cc_address) { $email_message->SetEncodedEmailHeader("Cc", $cc_address, $cc_name); } if ($bcc_address) { $email_message->SetEncodedEmailHeader("Bcc", $bcc_address, $bcc_name); } $email_message->SetEncodedEmailHeader("From", $from_address, $from_name); $email_message->SetEncodedEmailHeader("Reply-To", $reply_address, $reply_name); $email_message->SetEncodedEmailHeader("Errors-To", $error_delivery_address, $error_delivery_name); $email_message->AddQuotedPrintableTextPart($email_message->WrapText($text_message)); /* * Set the Return-Path header to define the envelope sender address to which bounced messages are delivered. * If you are using Windows, you need to use the smtp_message_class to set the return-path address. */ if (defined("PHP_OS") && strcmp(substr(PHP_OS, 0, 3), "WIN")) { $email_message->SetHeader("Return-Path", $error_delivery_address); } $email_message->SetEncodedHeader("Subject", $subject); if (isset($attachment, $filename, $contenttype)) { $file_attachment = array("Data" => "{$attachment}", "Name" => "{$filename}", "Content-Type" => "{$contenttype}", "Disposition" => "attachment"); $email_message->AddFilePart($file_attachment); } /* * The message is now ready to be assembled and sent. * Notice that most of the functions used before this point may fail due to * programming errors in your script. You may safely ignore any errors until * the message is sent to not bloat your scripts with too much error checking. */ $error = $email_message->Send(); if (strcmp($error, "")) { return false; } else { return true; } }
function JB_send_email($mail_row) { $to_name = JB_html_ent_to_utf8($mail_row['to_name']); $to_address = $mail_row['to_address']; $from_name = JB_html_ent_to_utf8($mail_row['from_name']); $from_address = $mail_row['from_address']; $subject = JB_html_ent_to_utf8($mail_row['subject']); $message = JB_html_ent_to_utf8($mail_row['message']); $html_message = JB_html_ent_to_utf8($mail_row['html_message']); if (JB_USE_MAIL_FUNCTION == 'YES') { $email_message = new email_message_class(); if (JB_EMAIL_DEBUG_SWITCH == 'YES') { echo 'Email Debug: Using the mail() function...<br>'; } } else { // use SMTP $dir = JB_basedirpath(); if (!class_exists("sasl_client_class")) { require_once $dir . "include/lib/mail/sasl/sasl.php"; } $email_message = new smtp_message_class(); $email_message->localhost = JB_EMAIL_HOSTNAME; $email_message->smtp_host = JB_EMAIL_SMTP_SERVER; $email_message->smtp_direct_delivery = 0; $email_message->smtp_exclude_address = ""; $email_message->smtp_user = JB_EMAIL_SMTP_USER; $email_message->smtp_realm = ""; $email_message->smtp_password = JB_EMAIL_SMTP_PASS; if (defined('JB_EMAIL_SMTP_PORT')) { if (!is_numeric(JB_EMAIL_SMTP_PORT)) { $email_message->smtp_port = 25; } else { $email_message->smtp_port = JB_EMAIL_SMTP_PORT; } } $email_message->authentication_mechanism = 'USER'; // SASL authentication if (JB_EMAIL_SMTP_SSL == 'YES') { $email_message->smtp_ssl = 1; } else { $email_message->smtp_ssl = 0; } if (JB_EMAIL_POP_BEFORE_SMTP == 'YES') { $email_message->smtp_pop3_auth_host = JB_EMAIL_SMTP_AUTH_HOST; } else { $email_message->smtp_pop3_auth_host = ""; } if (JB_EMAIL_DEBUG_SWITCH == 'YES') { $email_message->smtp_debug = 1; } else { $email_message->smtp_debug = 0; } $email_message->smtp_html_debug = 0; if (JB_EMAIL_DEBUG_SWITCH == 'YES') { echo 'Email Debug: using SMTP server...<br>'; } } $reply_address = $mail_row['from_address']; $error_delivery_name = JB_SITE_NAME; $error_delivery_address = JB_SITE_CONTACT_EMAIL; JBPLUG_do_callback('set_error_delivery_name', $error_delivery_name); // added in 3.6 JBPLUG_do_callback('set_error_delivery_address', $error_delivery_address); // added in 3.6 $email_message->default_charset = 'UTF-8'; $email_message->SetEncodedEmailHeader("To", $to_address, $to_name); $email_message->SetEncodedEmailHeader("From", $from_address, $from_name); $email_message->SetEncodedEmailHeader("Reply-To", $reply_address, $reply_name); /* Set the Return-Path header to define the envelope sender address to which bounced messages are delivered. If you are using Windows, you need to use the smtp_message_class to set the return-path address. */ // Cannot set in safe-mode or under Windows... if (function_exists("ini_get") && !ini_get("safe_mode") && strpos(strtoupper(PHP_OS), 'WIN') === false) { $email_message->SetHeader("Return-Path", $error_delivery_address); } if (strpos(strtoupper(PHP_OS), 'WIN') !== false) { // windows ini_set('sendmail_from', JB_SITE_CONTACT_EMAIL); } //} if ($mail_row['template_id'] == 5 || $mail_row['template_id'] == 6 || $mail_row['template_id'] == 7 || $mail_row['template_id'] == 8 || $mail_row['template_id'] == 30) { // job alerts, resume alerts, newsletter are bulk mails $email_message->SetHeader("Precedence", 'bulk'); } $email_message->SetEncodedEmailHeader("Errors-To", $error_delivery_address, $error_delivery_name); $email_message->SetEncodedHeader("Subject", $subject); if ($html_message == '') { // ONLY TEXT $email_message->AddQuotedPrintableTextPart($email_message->WrapText($message)); } else { $email_message->CreateQuotedPrintableHTMLPart($html_message, "", $html_part); //$text_message="This is an HTML message. Please use an HTML capable mail program to read this message."; $email_message->CreateQuotedPrintableTextPart($email_message->WrapText($message), "", $text_part); $alternative_parts = array($text_part, $html_part); $email_message->AddAlternativeMultipart($alternative_parts); } if ($mail_row['attachments'] == 'Y') { JB_add_mail_attachments($email_message, $mail_row); } JBPLUG_do_callback('set_mail_message', $email_message); // plugins can do additional operations on the $email_message, added in 3.6 $error = $email_message->Send(); if (strcmp($error, "")) { $now = gmdate("Y-m-d H:i:s"); $sql = "UPDATE mail_queue SET status='error', retry_count=retry_count+1, error_msg='" . jb_escape_sql(addslashes($error)) . "', `date_stamp`='{$now}' WHERE mail_id=" . jb_escape_sql($mail_row['mail_id']); JB_mysql_query($sql) or JB_q_mail_error(mysql_error() . $sql); } else { // note: on some servers (ie GoDaddy, connection to server can be // lost, so re-connect by pinging jb_mysql_ping(); $now = gmdate("Y-m-d H:i:s"); $sql = "UPDATE mail_queue SET status='sent', `date_stamp`='{$now}' WHERE mail_id='" . jb_escape_sql($mail_row['mail_id']) . "'"; JB_mysql_query($sql, $jb_mysql_link) or JB_q_mail_error(mysql_error() . $sql); } }
private function enviar_mail($titulo, $template) { global $ari; $plantilla = $ari->newTemplate(); $plantilla->caching = 0; $from_address = $ari->config->get('email', 'main'); $from_name = $ari->config->get('name', 'main'); $usuario = $this->get('usuario'); // datos del operador $to_address = $usuario->get('email'); $to_name = $this->name(); // datos del perfil $plantilla->assign('nombre', $this->name()); $plantilla->assign('telefono', $this->get('telefono')); // datos del usuario $plantilla->assign('usuario', $usuario->get('uname')); $plantilla->assign('email', $usuario->get('email')); //////////// mail send require_once $ari->get('enginedir') . DIRECTORY_SEPARATOR . 'librerias' . DIRECTORY_SEPARATOR . 'mimemessage' . DIRECTORY_SEPARATOR . 'smtp.php'; require_once $ari->get('enginedir') . DIRECTORY_SEPARATOR . 'librerias' . DIRECTORY_SEPARATOR . 'mimemessage' . DIRECTORY_SEPARATOR . 'email_message.php'; require_once $ari->get('enginedir') . DIRECTORY_SEPARATOR . 'librerias' . DIRECTORY_SEPARATOR . 'mimemessage' . DIRECTORY_SEPARATOR . 'smtp_message.php'; $email_message = new smtp_message_class(); $email_message->localhost = ""; $email_message->smtp_host = $ari->config->get('delivery', 'main'); $email_message->smtp_direct_delivery = 0; $email_message->smtp_exclude_address = ""; $email_message->smtp_user = ""; $email_message->smtp_realm = ""; $email_message->smtp_workstation = ""; $email_message->smtp_password = ""; $email_message->smtp_pop3_auth_host = ""; $email_message->smtp_debug = 0; $email_message->smtp_html_debug = 1; $email_message->SetEncodedEmailHeader("To", $to_address, '"' . $to_name . '" <' . $to_address . '>'); // al perfil $email_message->SetEncodedEmailHeader("Cc", $from_address, '"' . $from_name . '" <' . $from_address . '>'); // al sitio $email_message->SetEncodedEmailHeader("From", $from_address, '"' . $from_name . '" <' . $from_address . '>'); // del sitio $email_message->SetEncodedHeader("Subject", $from_name . ' - ' . $titulo); $email_message->AddQuotedPrintableHTMLPart($plantilla->fetch($ari->module->usertpldir() . DIRECTORY_SEPARATOR . $template)); return $email_message->Send(); }
/** * Send email service. * * Parameters are as follows: * $data = array( * 'mail_from_name' => '', * 'mail_from' => '', * 'mail_reply_name' => '', * 'mail_reply' => '', * 'mail_error_name' => '', * 'mail_error' => '', * 'mail_to_name' => '', * 'mail_to' => '', * 'mail_cc_name' => '', * 'mail_cc' => '', * 'mail_bcc_name' => '', * 'mail_bcc' => '', * 'mail_subject' => '', * 'mail_body' => '', * 'mail_charset' => '', * 'smtp_relm' => '', * 'smtp_user' => '', * 'smtp_pass' => '', * 'smtp_host' => '', * 'smtp_port' => '', * 'smtp_debug' => '', * 'smtp_direct' => '', * 'attachment_data' => '', * 'attachment_name' => '', * 'attachment_type' => '' * ); * * @param array * @return boolean */ function sendmail($data = array()) { global $core_config; if (is_array($data)) { $mail_from_name = $data['mail_from_name']; $mail_from = $data['mail_from']; $mail_reply_name = $data['mail_reply_name']; $mail_reply = $data['mail_reply']; $mail_error_name = $data['mail_error_name']; $mail_error = $data['mail_error']; $mail_to_name = $data['mail_to_name']; $mail_to = $data['mail_to']; $mail_cc_name = $data['mail_cc_name']; $mail_cc = $data['mail_cc']; $mail_bcc_name = $data['mail_bcc_name']; $mail_bcc = $data['mail_bcc']; $mail_subject = $data['mail_subject']; $mail_body = $data['mail_body']; $mail_charset = $data['mail_charset']; $smtp_relm = $data['smtp_relm']; $smtp_user = $data['smtp_user']; $smtp_pass = $data['smtp_pass']; $smtp_host = $data['smtp_host']; $smtp_port = $data['smtp_port']; $smtp_debug = $data['smtp_debug']; $smtp_direct = $data['smtp_direct']; $attachment_data = $data['attachment_data']; $attachment_name = $data['attachment_name']; $attachment_type = $data['attachment_type']; } logger_print("start from:" . $mail_from . " to:" . $mail_to . " subject:" . $mail_subject, 2, "sendmail"); if (!class_exists(email_message_class)) { include_once $core_config['apps_path']['plug'] . "/core/sendmail/lib/external/mimemessage/email_message.php"; } if (!class_exists(smtp_message_class)) { include_once $core_config['apps_path']['plug'] . "/core/sendmail/lib/external/mimemessage/smtp_message.php"; } if (!class_exists(smtp_class)) { include_once $core_config['apps_path']['plug'] . "/core/sendmail/lib/external/mimemessage/smtp/smtp.php"; } $from_name = $mail_from_name; $from_address = $mail_from; $reply_name = $mail_reply_name; $reply_address = $mail_reply; $error_delivery_name = $mail_error_name; $error_delivery_address = $mail_error; $to_name = $mail_to_name; $to_address = $mail_to; $cc_name = $mail_cc_name; $cc_address = $mail_cc; $bcc_name = $mail_bcc_name; $bcc_address = $mail_bcc; $subject = $mail_subject; $text_message = $mail_body; $email_message = new smtp_message_class(); $email_message->localhost = 'localhost'; $email_message->smtp_realm = $smtp_relm ? $smtp_relm : _SMTP_RELM_; $email_message->smtp_user = $smtp_user ? $smtp_user : _SMTP_USER_; $email_message->smtp_password = $smtp_pass ? $smtp_pass : _SMTP_PASS_; $email_message->smtp_host = $smtp_host ? $smtp_host : _SMTP_HOST_; $email_message->smtp_port = $smtp_port ? $smtp_port : _SMTP_PORT_; $email_message->smtp_debug = $smtp_debug ? 1 : 0; $email_message->smtp_direct_delivery = $smtp_direct ? 1 : 0; // default charset sets to UTF-8 (emmanuel) $email_message->default_charset = "UTF-8"; $email_message->SetEncodedEmailHeader("From", $from_address, $from_name); $email_message->SetEncodedEmailHeader("To", $to_address, $to_name); if ($cc_address) { $email_message->SetEncodedEmailHeader("Cc", $cc_address, $cc_name); } if ($bcc_address) { $email_message->SetEncodedEmailHeader("Bcc", $bcc_address, $bcc_name); } if ($reply_address) { $email_message->SetEncodedEmailHeader("Reply-To", $reply_address, $reply_name); } if ($error_delivery_address) { $email_message->SetEncodedEmailHeader("Errors-To", $error_delivery_address, $error_delivery_name); } $email_message->SetEncodedHeader("Subject", $subject); $email_message->AddQuotedPrintableTextPart($email_message->WrapText($text_message)); /* * Set the Return-Path header to define the envelope sender address to which bounced messages are delivered. * If you are using Windows, you need to use the smtp_message_class to set the return-path address. */ if (defined("PHP_OS") && strcmp(substr(PHP_OS, 0, 3), "WIN") && $error_delivery_address) { $email_message->SetHeader("Return-Path", $error_delivery_address); } if ($attachment_data && $attachment_name && $attachment_type) { $file_attachment = array('Data' => $attachment_data, 'Name' => $attachment_name, 'Content-Type' => $attachment_type, 'Disposition' => 'attachment'); $email_message->AddFilePart($file_attachment); } /* * The message is now ready to be assembled and sent. * Notice that most of the functions used before this point may fail due to * programming errors in your script. You may safely ignore any errors until * the message is sent to not bloat your scripts with too much error checking. */ $error = $email_message->Send(); if (strcmp($error, "")) { logger_print("end with error:" . $error, 2, "sendmail"); return false; } else { logger_print("end from:" . $mail_from . " to:" . $mail_to . " subject:" . $mail_subject, 2, "sendmail"); return true; } }
/* authentication realm or Windows domain when using NTLM authentication */ $email_message->smtp_realm = ""; /* authentication workstation name when using NTLM authentication */ $email_message->smtp_workstation = ""; /* force the use of a specific authentication mechanism */ $email_message->smtp_authentication_mechanism = ""; /* Output dialog with SMTP server */ $email_message->smtp_debug = 0; /* if smtp_debug is 1, * set this to 1 to make the debug output appear in HTML */ $email_message->smtp_html_debug = 1; /* If you use the SetBulkMail function to send messages to many users, * change this value if your SMTP server does not accept sending * so many messages within the same SMTP connection */ $email_message->maximum_bulk_deliveries = 100; $email_message->SetEncodedEmailHeader("To", $to_address, $to_name); $email_message->SetEncodedEmailHeader("From", $from_address, $from_name); $email_message->SetEncodedEmailHeader("Reply-To", $reply_address, $reply_name); $email_message->SetHeader("Return-Path", $error_delivery_address); $email_message->SetEncodedEmailHeader("Errors-To", $error_delivery_address, $error_delivery_name); $email_message->SetEncodedHeader("Subject", $subject); $email_message->AddQuotedPrintableTextPart($email_message->WrapText($message)); $error = $email_message->Send(); for ($recipient = 0, Reset($email_message->invalid_recipients); $recipient < count($email_message->invalid_recipients); Next($email_message->invalid_recipients), $recipient++) { echo "Invalid recipient: ", Key($email_message->invalid_recipients), " Error: ", $email_message->invalid_recipients[Key($email_message->invalid_recipients)], "\n"; } if (strcmp($error, "")) { echo "Error: {$error}\n"; } else { echo "Done.\n"; }
$email_message=new smtp_message_class; $email_message->localhost=""; $email_message->smtp_host=$ari->config->get('delivery', 'main'); $email_message->smtp_direct_delivery=0; $email_message->smtp_exclude_address=""; $email_message->smtp_user=""; $email_message->smtp_realm=""; $email_message->smtp_workstation=""; $email_message->smtp_password=""; $email_message->smtp_pop3_auth_host=""; $email_message->smtp_debug=0; $email_message->smtp_html_debug=1; $email_message->SetEncodedEmailHeader("To",$usuario[0]->get('email'),$usuario[0]->get('email')); $email_message->SetEncodedEmailHeader("From",$from_address,$from_name); $email_message->SetEncodedHeader("Subject",$from_name); $email_message->AddQuotedPrintableHTMLPart($mensaje); $email_message->Send(); /////////// end mail send } } if (isset($_POST['update'])) { $error = array(); if (!isset($_POST['code']) || $_POST['code'] == null) $error[]='INVALID_CODE'; if (!isset($_POST['email']) || $_POST['email'] == null)