本文整理汇总了PHP中phpmailer::ClearAddresses方法的典型用法代码示例。如果您正苦于以下问题:PHP phpmailer::ClearAddresses方法的具体用法?PHP phpmailer::ClearAddresses怎么用?PHP phpmailer::ClearAddresses使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpmailer
的用法示例。
在下文中一共展示了phpmailer::ClearAddresses方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: envmail
function envmail($email, $subject, $msg, $from, $fromname = "Opala Clube Franca")
{
require_once "class.phpmailer.php";
$mail = new phpmailer();
$mail->ClearAddresses();
$mail->ClearAllRecipients();
$mail->ClearAddresses();
$mail->ClearCustomHeaders();
$mail->IsSMTP();
// $mail->IsSendmail();
$mail->From = $from;
$mail->FromName = $fromname;
// $mail->Hostname = "smtp.gmail.com";
// $mail->Host = "smtp.gmail.com";
$mail->SMTPSecure = "ssl";
$mail->Hostname = "smtp.opalaclubefranca.com.br";
$mail->Host = "smtp.opalaclubefranca.com.br";
// $mail->SMTPDebug = 2;
$mail->Username = "admin@opalaclubefranca.com.br";
$mail->Password = "racnela";
$mail->SMTPAuth = true;
$mail->Port = 465;
$mail->Timeout = 120;
$body = $msg;
$text_body = $msg;
$mail->isHTML(true);
$mail->Subject = $subject;
$mail->Body = $body;
$mail->AltBody = $text_body;
if (is_array($email)) {
foreach ($email as $em) {
$mail->AddAddress($em, "");
}
} else {
$mail->AddAddress($email, "");
}
/* echo '<tr><td>To '.$email.'</td></tr>'."\n";
echo '<tr><td>Assunto '.$subject.'</td></tr>'."\n";
echo '<tr><td>Mensagem '.$msg.'</td></tr>'."\n";
echo '<tr><td>From '.$from.'</td></tr>'."\n";
*/
$exito = $mail->Send();
$v = 0;
// echo "<tr><td>ErrorInfo " . $mail->ErrorInfo . "<br></td></tr>";
while (!$exito && $v < 5 && $mail->ErrorInfo != "SMTP Error: Data not accepted.") {
sleep(2);
$exito = $mail->Send();
echo "<tr><td>ErrorInfo " . $mail->ErrorInfo . "<br></td></tr>";
$v = $v + 1;
}
if (!$exito) {
echo "<tr><td>There has been a mail error sending to " . $mail->ErrorInfo . "<br></td></tr>";
}
$mail->ClearAddresses();
$mail->ClearAttachments();
return $mail->ErrorInfo;
}
示例2: sendmail
function sendmail($subject, $mailcontent, $receiver, $receivername, $attachment = "")
{
if (strpos($_SERVER['HTTP_HOST'], "localhost")) {
return false;
}
$mail = new phpmailer();
$mail->IsSMTP();
$mail->Host = "mail.pepool.com";
$mail->Port = 2525;
$mail->SMTPAuth = true;
$mail->Username = "info+pepool.com";
// Write SMTP username in ""
$mail->Password = "*VTWqNzPNKlut";
$mail->Mailer = "smtp";
$mail->IsHTML(true);
$mail->ClearAddresses();
$mail->From = "info@pepool.com";
$mail->FromName = "pepool";
$mail->Subject = $subject;
$mail->Body = $mailcontent;
$mail->AddAddress($receiver, $receivername);
if ($attachment != '') {
$mail->AddAttachment($attachment);
}
$suc = $mail->Send();
return $suc > 0;
}
示例3: send
function send($newsletter_id)
{
global $db;
$owpDBTable = owpDBGetTables();
$send_mail = new phpmailer();
$send_mail->From = OWP_EMAIL_ADDRESS;
$send_mail->FromName = OWP_NAME;
$send_mail->Subject = $this->title;
$sql = "SELECT admin_gender, admin_firstname, admin_lastname,\n admin_email_address \n FROM " . $owpDBTable['administrators'] . " \n WHERE admin_newsletter = '1'";
$mail_values = $db->Execute($sql);
while ($mail = $mail_values->fields) {
$send_mail->Body = $this->content;
$send_mail->AddAddress($mail['admin_email_address'], $mail['admin_firstname'] . ' ' . $mail['admin_lastname']);
$send_mail->Send();
// Clear all addresses and attachments for next loop
$send_mail->ClearAddresses();
$send_mail->ClearAttachments();
$mail_values->MoveNext();
}
$today = date("Y-m-d H:i:s");
$db->Execute("UPDATE " . $owpDBTable['newsletters'] . " \n SET date_sent = " . $db->DBTimeStamp($today) . ",\n status = '1' \n WHERE newsletters_id = '" . owpDBInput($newsletter_id) . "'");
}
示例4: SendMail
function SendMail($email, $name, $subject, $message)
{
global $sockethost, $smtpauth, $smtpauthuser, $smtpauthpass, $socketfrom, $socketfromname, $socketreply, $socketreplyname;
include 'class.phpmailer.php';
$mail = new phpmailer();
$mail->IsSMTP();
$mail->Host = $sockethost;
if ($smtpauth == 'TRUE') {
$mail->SMTPAuth = true;
$mail->Username = $smtpauthuser;
$mail->Password = $smtpauthpass;
}
if (isset($_GET['caseid']) && ($_GET['caseid'] == 'NewTicket' || $_GET['caseid'] == 'view')) {
$mail->From = $email;
$mail->FromName = $name;
$mail->AddReplyTo($email, $name);
} else {
$mail->From = $socketfrom;
$mail->FromName = $socketfromname;
$mail->AddReplyTo($socketreply, $socketreplyname);
}
$mail->IsHTML(False);
$mail->Body = $message;
$mail->Subject = $subject;
if (isset($_GET['caseid']) && ($_GET['caseid'] == 'NewTicket' || $_GET['caseid'] == 'view')) {
$mail->AddAddress($socketfrom, $socketfromname);
} else {
$mail->AddAddress($email, $name);
}
if (!$mail->Send()) {
return 'Error: ' . $mail->ErrorInfo;
} else {
return 'Email Sent.';
}
$mail->ClearAddresses();
}
示例5: sendMail
function sendMail($fileIN, $fileOUT, $naviera)
{
//$razonSocial = "MOPSA, S.A. de C.V.";
$dominio = "www.almartcon.com";
$att = "Robot";
$fileINOnlyName = str_replace("../ediCodeco/", "", $fileIN);
$fileOUTOnlyName = str_replace("../ediCodeco/", "", $fileOUT);
// ------------------------------------------------
// CONFIGURAR EMAIL.
// ------------------------------------------------
//Definimos las propiedades y llamamos a los métodos
//correspondientes del objeto mail
//Con PluginDir le indicamos a la clase phpmailer donde se
//encuentra la clase smtp que como he comentado al principio de
//este ejemplo va a estar en el subdirectorio includes
$mail = new phpmailer();
$mail->Priority = 0;
// Se declara la prioridad del mensaje.
$mail->PluginDir = "../include/";
$mail->Mailer = "smtp";
$mail->Port = 26;
// Configurar la cuenta de correo.
$mail->Host = "mail.nesoftware.net";
$mail->SMTPAuth = true;
$mail->Username = "robot-almartcon@nesoftware.net";
$mail->Password = "UF+)8&;-(6Oy";
$mail->From = "robot-almartcon@nesoftware.net";
$mail->FromName = "Robot ALMARTCON";
//El valor por defecto 10 de Timeout es un poco escaso dado que voy a usar
//una cuenta gratuita, por tanto lo pongo a 30
//$mail->Timeout=10;
$mail->Timeout = 10;
// --------------------
// FORMATO HTML
// --------------------
$mail->Body = "\n <html>\n <body>\n <font size=\"3\"><b>EDI-CODECO</b></font>\n <hr>\n <p>\n A quien corresponda : <br>\n <br>\n El sistema Web ({$dominio}) ha detectado en automático nuevas entradas y salidas mismas que fueron codificadas en formato\n EDI-CODECO para reconocimiento informático de otros sistemas navieros.\n <br>\n <b>Naviera :</b> {$naviera} <br>\n <b>Archivo GateIN :</b> {$fileINOnlyName} <br>\n <b>Archivo GateOUT:</b> {$fileOUTOnlyName} <br>\n <br>\n <i>\n Att. {$att} <br>\n </i>\n <p>\n <hr>\n <font color=\"red\" size=\"2\">\n <i>Este es un correo de envio automático generado por nuestro sistema {$dominio}, por favor no responda este email.<br></i>\n </font>\n <br>\n <br>\n <br>\n </body>\n </html>\n\n ";
// -------------------------------------------------------
// FORMATO TEXTO
// Definimos AltBody por si el destinatario del correo
// no admite email con formato html
// -------------------------------------------------------
$mail->AltBody = "\n =====================================================================\n ";
// Nota :
// La direccion PARA solo se puede manejar 1.
// Las direcciones CC puede manejar N correos.
// -------------
// Destinatarios
// -------------
$mail->ClearAddresses();
// ------------------------------------------------
// TO : Luis Felipe Pineda Mendoza <traluispineda@gmail.com>
$mail->AddAddress("traluispineda@gmail.com");
//$mail->AddCC( "nestor@nesoftware.net" );
//$mail->AddCC( "lemuel@nesoftware.net" );
// Subject :
$mail->Subject = "[EDI-CODECO] {$naviera} ";
//Incluir Attach.
$mail->AddAttachment($fileIN, $fileINOnlyName);
$mail->AddAttachment($fileOUT, $fileOUTOnlyName);
// Se envia el mensaje, si no ha habido problemas, la variable $exito tendra el valor true
//if( is_array($arrEdiFile) ){
$exito = $mail->Send();
/*
// PARA INTAR REENVIARLO
//Si el mensaje no ha podido ser enviado se realizaran 4 intentos mas como mucho
//para intentar enviar el mensaje, cada intento se hara 5 segundos despues
//del anterior, para ello se usa la funcion sleep
$intentos=1;
while ((!$exito) && ($intentos < 5)) {
sleep(5);
$exito = $mail->Send();
$intentos=$intentos+1;
}
*/
if (!$exito) {
echo "[ <font color=red><b>Problema de envio</b></font> ] " . $mail->ErrorInfo . "<br>";
} else {
echo "[ <font color=green><b>OK, E-Mail enviado.</b></font> ] <br>";
}
if (file_exists($fileIN)) {
unlink($fileIN);
}
if (file_exists($fileOUT)) {
unlink($fileOUT);
}
}
示例6: strftime
$send_mail->Subject = EMAIL_COUNTRIES_CVS . strftime(DATE_FORMAT_LONG);
if ($mail_send_to['admin_gender'] == 'm') {
$body = EMAIL_GREET_MR . $mail_send_to['admin_lastname'] . ',' . "\n\n";
} else {
$body = EMAIL_GREET_MS . $mail_send_to['admin_lastname'] . ',' . "\n\n";
}
$body .= EMAIL_CVS_INTRO . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
$body .= EMAIL_FTP_INFO . "\n";
$body .= ' ' . $db_table_file . "\n\n";
$body .= EMAIL_FOOT;
$send_mail->Body = $body;
$send_mail->AddAddress($mail_send_to['admin_email_address'], $mail_send_to['admin_firstname'] . ' ' . $mail_send_to['admin_lastname']);
$send_mail->AddAttachment(OWP_CSV_TEMP . $db_table_file);
$send_mail->Send();
// Clear all addresses and attachments for next loop
$send_mail->ClearAddresses();
$send_mail->ClearAttachments();
$messageStack->add_session(sprintf(SUCCESS_CVS_COUNTRIES_SENT, $mail_send_to['admin_email_address']), 'notice');
}
// download
if (CVS_DOWNLOAD == 'true') {
$fp = fopen(OWP_CSV_TEMP . $db_table_file, 'r');
$buffer = fread($fp, filesize(OWP_CSV_TEMP . $db_table_file));
fclose($fp);
if (CVS_DELETE_FILE == 'true' && CVS_SEND_MAIL == 'false') {
@unlink(OWP_CSV_TEMP . $db_table_file);
}
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment; filename="' . $db_table_file . '"');
header('Expires: 0');
header('Pragma: no-cache');
示例7: sendStateMsg
private function sendStateMsg()
{
if (!empty($this->obj)) {
if ($this->change_state && ($state = ormObjects::get($this->obj->state)) && $state->info) {
page::assign('order.id', $this->obj->id);
page::assign('order.number', $this->getNumber());
page::assign('order.cost', $this->getTotalCost());
// Информация о доставке
page::assign('order.delivery', $this->obj->_delivery);
page::assign('order.delivery_price', $this->getDeliveryPrice());
page::assign('order.name', $this->obj->delivery_name);
page::assign('order.surname', $this->obj->delivery_surname);
page::assign('order.phone', $this->obj->delivery_phone);
page::assign('order.address', $this->obj->delivery_address);
page::assign('username', user::get('surname') . ' ' . user::get('name'));
page::assign('goods_list', page::macros('eshop')->goodsList($this->obj->id, 'goods_list_email'));
$text = str_replace(array('{', '}'), '%', $state->email_msg);
$title = str_replace(array('{', '}'), '%', $state->email_title);
$mail = new phpmailer();
$mail->WordWrap = 50;
$mail->IsHTML(true);
$mail->From = domains::curDomain()->getEmail();
$mail->FromName = domains::curDomain()->getSiteName();
$mail->Subject = page::parse($title);
$mail->Body = page::parse($text);
// Отправляем письмо пользователю
$mail->AddAddress($this->obj->email);
$mail->Send();
// Отправляем письмо администратору
if ($state->id == reg::getKey('/eshop/fisrt_state') && reg::getKey('/eshop/dubl_to_email')) {
$mail->ClearAddresses();
$mail->AddAddress(domains::curDomain()->getEmail());
$mail->Send();
}
}
}
}
示例8: send
//.........这里部分代码省略.........
//DBG::log("MailTemplate::send(): Substituted: ".var_export($arrTemplate, true));
//echo("MailTemplate::send(): Substituted:<br /><pre>".nl2br(htmlentities(var_export($arrTemplate, true), ENT_QUOTES, CONTREXX_CHARSET))."</PRE><hr />");
//die();//return true;
// Use defaults for missing mandatory fields
// if (empty($arrTemplate['sender']))
// $arrTemplate['sender'] = $_CONFIG['coreAdminName'];
if (empty($arrTemplate['from'])) {
\DBG::log("MailTemplate::send(): INFO: Empty 'from:', falling back to config");
$arrTemplate['from'] = $_CONFIG['coreAdminEmail'];
}
if (empty($arrTemplate['to'])) {
\DBG::log("MailTemplate::send(): INFO: Empty 'to:', falling back to config");
$arrTemplate['to'] = $_CONFIG['coreAdminEmail'];
}
// if (empty($arrTemplate['subject']))
// $arrTemplate['subject'] = $_CORELANG['TXT_CORE_MAILTEMPLATE_NO_SUBJECT'];
// if (empty($arrTemplate['message']))
// $arrTemplate['message'] = $_CORELANG['TXT_CORE_MAILTEMPLATE_NO_MESSAGE'];
$objMail->FromName = $arrTemplate['sender'];
$objMail->From = $arrTemplate['from'];
$objMail->Subject = $arrTemplate['subject'];
$objMail->CharSet = CONTREXX_CHARSET;
// $objMail->IsHTML(false);
if ($arrTemplate['html']) {
$objMail->IsHTML(true);
$objMail->Body = $arrTemplate['message_html'];
$objMail->AltBody = $arrTemplate['message'];
} else {
$objMail->Body = $arrTemplate['message'];
}
foreach (preg_split('/\\s*,\\s*/', $arrTemplate['reply'], null, PREG_SPLIT_NO_EMPTY) as $address) {
$objMail->AddReplyTo($address);
}
// foreach (preg_split('/\s*,\s*/', $arrTemplate['to'], null, PREG_SPLIT_NO_EMPTY) as $address) {
// $objMail->AddAddress($address);
// }
foreach (preg_split('/\\s*,\\s*/', $arrTemplate['cc'], null, PREG_SPLIT_NO_EMPTY) as $address) {
$objMail->AddCC($address);
}
foreach (preg_split('/\\s*,\\s*/', $arrTemplate['bcc'], null, PREG_SPLIT_NO_EMPTY) as $address) {
$objMail->AddBCC($address);
}
// Applicable to attachments stored with the MailTemplate only!
$arrTemplate['attachments'] = self::attachmentsToArray($arrTemplate['attachments']);
//DBG::log("MailTemplate::send(): Template Attachments: ".var_export($arrTemplate['attachments'], true));
// Now the MailTemplates' attachments index is guaranteed to
// contain an array.
// Add attachments from the parameter array, if any.
if (isset($arrField['attachments']) && is_array($arrField['attachments'])) {
foreach ($arrField['attachments'] as $path => $name) {
// if (empty($path)) $path = $name;
// if (empty($name)) $name = basename($path);
$arrTemplate['attachments'][$path] = $name;
//DBG::log("MailTemplate::send(): Added Field Attachment: $path / $name");
}
}
//DBG::log("MailTemplate::send(): All Attachments: ".var_export($arrTemplate['attachments'], true));
foreach ($arrTemplate['attachments'] as $path => $name) {
if (is_numeric($path)) {
$path = $name;
}
$objMail->AddAttachment(ASCMS_DOCUMENT_ROOT . '/' . $path, $name);
}
$arrTemplate['inline'] = self::attachmentsToArray($arrTemplate['inline']);
if ($arrTemplate['inline']) {
$arrTemplate['html'] = true;
}
foreach ($arrTemplate['inline'] as $path => $name) {
if (is_numeric($path)) {
$path = $name;
}
$objMail->AddEmbeddedImage(ASCMS_DOCUMENT_ROOT . '/' . $path, uniqid(), $name);
}
if (isset($arrField['inline']) && is_array($arrField['inline'])) {
$arrTemplate['html'] = true;
foreach ($arrField['inline'] as $path => $name) {
if (is_numeric($path)) {
$path = $name;
}
$objMail->AddEmbeddedImage(ASCMS_DOCUMENT_ROOT . '/' . $path, uniqid(), $name);
}
}
//die("MailTemplate::send(): Attachments and inlines<br />".var_export($objMail, true));
$objMail->CharSet = CONTREXX_CHARSET;
$objMail->IsHTML($arrTemplate['html']);
//DBG::log("MailTemplate::send(): Sending: ".nl2br(htmlentities(var_export($objMail, true), ENT_QUOTES, CONTREXX_CHARSET))."<br />Sending...<hr />");
$result = true;
foreach (preg_split('/\\s*;\\s*/', $arrTemplate['to'], null, PREG_SPLIT_NO_EMPTY) as $addresses) {
$objMail->ClearAddresses();
foreach (preg_split('/\\s*[,]\\s*/', $addresses, null, PREG_SPLIT_NO_EMPTY) as $address) {
$objMail->AddAddress($address);
}
//DBG::log("MailTemplate::send(): ".var_export($objMail, true));
// TODO: Comment for test only!
$result &= $objMail->Send();
// TODO: $objMail->Send() seems to sometimes return true on localhost where
// sending the mail is actually impossible. Dunno why.
}
return $result;
}
示例9: elseif
/**
* Send Recommendation
*
* Send an email if the input is valid. Otherwise
* Show some error messages and the form again
*/
function _sendRecomm()
{
global $_ARRAYLANG, $_CONFIG, $_LANGID, $_CORELANG;
if (empty($_POST['receivername'])) {
$this->_pageMessage .= $_ARRAYLANG['TXT_STATUS_RECEIVER_NAME'] . ' ' . $_ARRAYLANG['TXT_IS_EMPTY'] . '<br />';
}
if (empty($_POST['receivermail'])) {
$this->_pageMessage .= $_ARRAYLANG['TXT_STATUS_RECEIVER_MAIL'] . ' ' . $_ARRAYLANG['TXT_IS_EMPTY'] . '<br />';
} elseif (!$this->isEmail($_POST['receivermail'])) {
$this->_pageMessage .= $_ARRAYLANG['TXT_STATUS_RECEIVER_MAIL'] . ' ' . $_ARRAYLANG['TXT_IS_INVALID'] . '<br />';
}
if (empty($_POST['sendername'])) {
$this->_pageMessage .= $_ARRAYLANG['TXT_STATUS_SENDER_NAME'] . ' ' . $_ARRAYLANG['TXT_IS_EMPTY'] . '<br />';
}
if (empty($_POST['sendermail'])) {
$this->_pageMessage .= $_ARRAYLANG['TXT_STATUS_SENDER_MAIL'] . ' ' . $_ARRAYLANG['TXT_IS_EMPTY'] . '<br />';
} elseif (!$this->isEmail($_POST['sendermail'])) {
$this->_pageMessage .= $_ARRAYLANG['TXT_STATUS_SENDER_MAIL'] . ' ' . $_ARRAYLANG['TXT_IS_INVALID'] . '<br />';
}
if (empty($_POST['comment'])) {
$this->_pageMessage .= $_ARRAYLANG['TXT_STATUS_COMMENT'] . ' ' . $_ARRAYLANG['TXT_IS_EMPTY'] . '<br />';
}
$receivername = $_POST['receivername'];
$receivermail = $_POST['receivermail'];
$sendername = $_POST['sendername'];
$sendermail = $_POST['sendermail'];
$comment = $_POST['comment'];
if (!empty($this->_pageMessage) || !\Cx\Core_Modules\Captcha\Controller\Captcha::getInstance()->check()) {
//something's missing or wrong
$this->_objTpl->setVariable('RECOM_STATUS', '<div class="text-danger">' . $this->_pageMessage . '</div>');
$this->_objTpl->setCurrentBlock('recommend_form');
$this->_objTpl->setVariable(array('RECOM_SCRIPT' => $this->getJs(), 'RECOM_RECEIVER_NAME' => stripslashes($receivername), 'RECOM_RECEIVER_MAIL' => stripslashes($receivermail), 'RECOM_SENDER_NAME' => stripslashes($sendername), 'RECOM_SENDER_MAIL' => stripslashes($sendermail), 'RECOM_COMMENT' => stripslashes($comment), 'RECOM_PREVIEW' => $this->getMessageBody($_LANGID), 'RECOM_FEMALE_SALUTATION_TEXT' => $this->getFemaleSalutation($_LANGID), 'RECOM_MALE_SALUTATION_TEXT' => $this->getMaleSalutation($_LANGID)));
$this->_objTpl->setVariable(array('RECOM_TXT_RECEIVER_NAME' => $_ARRAYLANG['TXT_RECEIVERNAME_FRONTEND'], 'RECOM_TXT_RECEIVER_MAIL' => $_ARRAYLANG['TXT_RECEIVERMAIL_FRONTEND'], 'RECOM_TXT_GENDER' => $_ARRAYLANG['TXT_GENDER_FRONTEND'], 'RECOM_TXT_SENDER_NAME' => $_ARRAYLANG['TXT_SENDERNAME_FRONTEND'], 'RECOM_TXT_SENDER_MAIL' => $_ARRAYLANG['TXT_SENDERMAIL_FRONTEND'], 'RECOM_TXT_COMMENT' => $_ARRAYLANG['TXT_COMMENT_FRONTEND'], 'RECOM_TXT_PREVIEW' => $_ARRAYLANG['TXT_PREVIEW_FRONTEND'], 'RECOM_TXT_FEMALE' => $_ARRAYLANG['TXT_FEMALE_FRONTEND'], 'RECOM_TXT_MALE' => $_ARRAYLANG['TXT_MALE_FRONTEND'], 'RECOM_TEXT' => $_ARRAYLANG['TXT_INTRODUCTION'], 'TXT_RECOMMEND_SEND' => $_ARRAYLANG['TXT_RECOMMEND_SEND'], 'TXT_RECOMMEND_DELETE' => $_ARRAYLANG['TXT_RECOMMEND_DELETE']));
$this->_objTpl->setVariable(array('RECOM_TXT_CAPTCHA' => $_CORELANG['TXT_CORE_CAPTCHA'], 'RECOM_CAPTCHA_CODE' => \Cx\Core_Modules\Captcha\Controller\Captcha::getInstance()->getCode()));
if ($this->_objTpl->blockExists('recommend_captcha')) {
$this->_objTpl->parse('recommend_captcha');
} else {
$this->_objTpl->hideBlock('recommend_captcha');
}
$this->_objTpl->parseCurrentBlock('recommend_form');
$this->_objTpl->parse();
} else {
//data is valid
if (empty($_POST['uri'])) {
$url = ASCMS_PROTOCOL . '://' . $_SERVER['HTTP_HOST'] . ASCMS_PATH_OFFSET;
} else {
$url = $_POST['uri'];
}
if ($_POST['gender'] == 'male') {
$salutation = $this->getMaleSalutation($_LANGID);
} else {
$salutation = $this->getFemaleSalutation($_LANGID);
}
$body = $this->getMessageBody($_LANGID);
$body = preg_replace('/<SENDER_NAME>/', $sendername, $body);
$body = preg_replace('/<SENDER_MAIL>/', $sendermail, $body);
$body = preg_replace('/<RECEIVER_NAME>/', $receivername, $body);
$body = preg_replace('/<RECEIVER_MAIL>/', $receivermail, $body);
$body = preg_replace('/<URL>/', $url, $body);
$body = preg_replace('/<COMMENT>/', $comment, $body);
$body = preg_replace('/<SALUTATION>/', $salutation, $body);
$subject = $this->getMessageSubject($_LANGID);
$subject = preg_replace('/<SENDER_NAME>/', $sendername, $subject);
$subject = preg_replace('/<SENDER_MAIL>/', $sendermail, $subject);
$subject = preg_replace('/<RECEIVER_NAME>/', $receivername, $subject);
$subject = preg_replace('/<RECEIVER_MAIL>/', $receivermail, $subject);
$subject = preg_replace('/<URL>/', $url, $subject);
$subject = preg_replace('/<COMMENT>/', $comment, $subject);
$subject = preg_replace('/<SALUTATION>/', $salutation, $subject);
if (@(include_once ASCMS_LIBRARY_PATH . '/phpmailer/class.phpmailer.php')) {
$objMail = new \phpmailer();
if ($_CONFIG['coreSmtpServer'] > 0) {
if (($arrSmtp = \SmtpSettings::getSmtpAccount($_CONFIG['coreSmtpServer'])) !== false) {
$objMail->IsSMTP();
$objMail->Host = $arrSmtp['hostname'];
$objMail->Port = $arrSmtp['port'];
$objMail->SMTPAuth = true;
$objMail->Username = $arrSmtp['username'];
$objMail->Password = $arrSmtp['password'];
}
}
$objMail->CharSet = CONTREXX_CHARSET;
$objMail->SetFrom($sendermail, $sendername);
$objMail->Subject = $subject;
$objMail->IsHTML(false);
$objMail->Body = $body;
$objMail->AddAddress($receivermail);
$objMail->Send();
$objMail->ClearAddresses();
$objMail->AddAddress($_CONFIG['contactFormEmail']);
$objMail->Send();
}
$this->_objTpl->setVariable('RECOM_STATUS', $_ARRAYLANG['TXT_SENT_OK']);
$this->_objTpl->parse();
//.........这里部分代码省略.........
示例10: sendAviso
function sendAviso($idNaviera, $msg, $subject)
{
global $db, $hoy, $mscIdUsuario;
/*
---------------------------------------------------------------
Esta funcion se encarga de enviar un tipo de AVISO a todos los
clientes del catalogo CS_CLIENTE, pero antes debe detectar a que correos los debe
enviar.
---------------------------------------------------------------
*/
$mail = new phpmailer();
$mail->Priority = 0;
// Se declara la prioridad del mensaje.
/*
// EMAIL NAVIERA
$sql = "select naviera,email from NAVIERA where id_naviera='$idNaviera'";
$db->query ( $sql );
while ( $db->next_record () ) {
$naviera = $db->f( naviera );
$emailCad = $db->f(email);
}
*/
$emailCad = "jorge.monjaraz.f@gmail.com";
// ------------------------------------------------
// CONFIGURAR EMAIL.
// ------------------------------------------------
//Definimos las propiedades y llamamos a los métodos
//correspondientes del objeto mail
//Con PluginDir le indicamos a la clase phpmailer donde se
//encuentra la clase smtp que como he comentado al principio de
//este ejemplo va a estar en el subdirectorio includes
//$mail->PluginDir = "includes/";
$mail = new phpmailer();
$mail->Priority = 0;
// Se declara la prioridad del mensaje.
$mail->PluginDir = "../include/";
$mail->Mailer = "smtp";
// Configurar la cuenta de correo.
$mail->Host = "vishnu.hosting-mexico.net";
$mail->SMTPAuth = true;
$mail->Username = "robot@almartcon-sys.com.mx";
$mail->Password = "#h]7gFL;B+{0";
$mail->From = "robot@almartcon-sys.com.mx";
$mail->FromName = "Robot ALMARTCON";
$mail->Timeout = 10;
// --------------------
// FORMATO HTML
// --------------------
$mail->Body = "\n <html>\n\n <b>ALMARTCON, S.A. de C.V. </b><br>\n <br>\n <center> \n\n </center>\n <p> \n <center><font size=4 color=blUE>* R E P O R T E S *</font></center> \n <p> \n {$msg}\n\n </body>\n </html>\n ";
$mail->AltBody = "\n ALMARTCON, S.A. de C.V.\n =====================================================================\n ";
// --------------------------------------------------------------
// Reconocer las cuentas de correo que tiene asignadas el cliente.
// Se enviara copia de la notificación via email.
// --------------------------------------------------------------
//$arrDirDestino = array_unique($arrDirDestino);
// Agrupar direcciones "PARA:";
$mail->ClearAddresses();
$flgOk = 0;
// -----------
// TEST NESTOR
// -----------
/*
if( $idNaviera==13 ){
$emailCad = "ijdiaz@maritimex.com.mx,em@clipper-solutions.com,nestor@nesoftware.net";
$subject = "[ALMARTCON, S.A. de C.V.] ** TEST ** ";
}
*/
$emailCad = str_replace(" ", "", $emailCad);
$arrDirDestino = explode(",", $emailCad);
foreach ($arrDirDestino as $emailDestino) {
$emailDestino = trim($emailDestino);
if (!empty($emailDestino)) {
$mail->AddAddress($emailDestino);
$flgOk = 1;
}
}
// Si Existe por lo menos una cuenta de destino, entonces que genere el email.
if ($flgOk == 1) {
// -------------
// Destinatarios
// -------------
// Con copia A:
$mail->AddCC("operacion@almartcon.com");
$mail->AddBCC("jmonjaraz@nesoftware.net");
//$mail->AddBCC("nestor@nesoftware.net");
// Subject :
$mail->Subject = $subject;
// Incluir Attach.
$mail->AddAttachment("../files/EntradasNav.xlsx", "Status-Conte.xlsx");
//$mail->AddAttachment("../files/SalidasNav.csv","Salidas.csv");
//$mail->AddAttachment("../files/InventarioNav.csv","Inventario.csv");
// Se envia el mensaje, si no ha habido problemas, la variable $exito tendra el valor true
$exito = $mail->Send();
echo "[ <font color=blue><b>El Msj se envio con exito a {$naviera}!</b></font> ] <br>";
} else {
echo "[ <font color=red><b>Falta Email</b></font> ] <a href=\"javascript:ventanaNueva('csNfyCatCli2.php?modo=consulta&idCliente={$idCliente}',600,400)\">{$cliente}</a> <br>";
}
}
示例11: sendMail
/**
* Send a confirmation e-mail to the address specified in the form,
* if any.
* @param $id
* @param unknown_type $email
* @return unknown
*/
function sendMail($feedId, $email)
{
global $_CONFIG, $objDatabase, $_ARRAYLANG, $objInit;
$feedId = intval($feedId);
$languageId = null;
// Get the user ID and entry information
$objResult = $objDatabase->Execute("\n SELECT addedby, title, language\n FROM " . DBPREFIX . "module_directory_dir\n WHERE id='{$feedId}'");
if ($objResult && !$objResult->EOF) {
$userId = $objResult->fields['addedby'];
$feedTitle = $objResult->fields['title'];
$languageId = $objResult->fields['language'];
}
// Get user data
if (is_numeric($userId)) {
$objFWUser = new \FWUser();
if ($objFWUser->objUser->getUser($userId)) {
$userMail = $objFWUser->objUser->getEmail();
$userFirstname = $objFWUser->objUser->getProfileAttribute('firstname');
$userLastname = $objFWUser->objUser->getProfileAttribute('lastname');
$userUsername = $objFWUser->objUser->getUsername();
}
}
if (!empty($email)) {
$sendTo = $email;
$mailId = 2;
} else {
// FIXED: The mail addresses may *both* be empty!
// Adding the entry was sucessful, however. So we can probably assume
// that it was a success anyway?
// Added:
if (empty($userMail)) {
return true;
}
// ...and a boolean return value below.
$sendTo = $userMail;
$mailId = 1;
}
//get mail content n title
$objResult = $objDatabase->Execute("\n SELECT title, content\n FROM " . DBPREFIX . "module_directory_mail\n WHERE id='{$mailId}'");
if ($objResult && !$objResult->EOF) {
$subject = $objResult->fields['title'];
$message = $objResult->fields['content'];
}
if ($objInit->mode == 'frontend') {
$link = "http://" . $_CONFIG['domainUrl'] . CONTREXX_SCRIPT_PATH . "?section=Directory&cmd=detail&id=" . $feedId;
} else {
$link = "http://" . $_CONFIG['domainUrl'] . ASCMS_PATH_OFFSET . '/' . \FWLanguage::getLanguageParameter($languageId, 'lang') . '/' . CONTREXX_DIRECTORY_INDEX . "?section=Directory&cmd=detail&id=" . $feedId;
}
// replace placeholders
$array_1 = array('[[USERNAME]]', '[[FIRSTNAME]]', '[[LASTNAME]]', '[[TITLE]]', '[[LINK]]', '[[URL]]', '[[DATE]]');
$array_2 = array($userUsername, $userFirstname, $userLastname, $feedTitle, $link, $_CONFIG['domainUrl'] . ASCMS_PATH_OFFSET, date(ASCMS_DATE_FORMAT));
$subject = str_replace($array_1, $array_2, $subject);
$message = str_replace($array_1, $array_2, $message);
$sendTo = explode(';', $sendTo);
if (@\Env::get('ClassLoader')->loadFile(ASCMS_LIBRARY_PATH . '/phpmailer/class.phpmailer.php')) {
$objMail = new \phpmailer();
if ($_CONFIG['coreSmtpServer'] > 0 && @\Env::get('ClassLoader')->loadFile(ASCMS_CORE_PATH . '/SmtpSettings.class.php')) {
$arrSmtp = SmtpSettings::getSmtpAccount($_CONFIG['coreSmtpServer']);
if ($arrSmtp !== false) {
$objMail->IsSMTP();
$objMail->Host = $arrSmtp['hostname'];
$objMail->Port = $arrSmtp['port'];
$objMail->SMTPAuth = true;
$objMail->Username = $arrSmtp['username'];
$objMail->Password = $arrSmtp['password'];
}
}
$objMail->CharSet = CONTREXX_CHARSET;
$objMail->From = $_CONFIG['coreAdminEmail'];
$objMail->FromName = $_CONFIG['coreAdminName'];
$objMail->AddReplyTo($_CONFIG['coreAdminEmail']);
$objMail->Subject = $subject;
$objMail->IsHTML(false);
$objMail->Body = $message;
foreach ($sendTo as $mailAdress) {
$objMail->ClearAddresses();
$objMail->AddAddress($mailAdress);
$objMail->Send();
}
}
return true;
}
示例12: sendMail
function sendMail()
{
//$razonSocial = "Lition Logistics, S.A. de C.V.";
$dominio = "www.litionlogistics.com/";
$att = "Robot";
// $fileINOnlyName = str_replace("../ediCodeco/","",$fileIN);
// $fileOUTOnlyName = str_replace("../ediCodeco/","",$fileOUT);
// ------------------------------------------------
// CONFIGURAR EMAIL.
// ------------------------------------------------
//Definimos las propiedades y llamamos a los métodos
//correspondientes del objeto mail
//Con PluginDir le indicamos a la clase phpmailer donde se
//encuentra la clase smtp que como he comentado al principio de
//este ejemplo va a estar en el subdirectorio includes
$mail = new phpmailer();
$mail->Priority = 0;
// Se declara la prioridad del mensaje.
$mail->PluginDir = "../include/";
$mail->Mailer = "smtp";
// Configurar la cuenta de correo.
$mail->Host = "vishnu.hosting-mexico.net";
$mail->SMTPAuth = true;
$mail->Username = "robot@lition-sys.com.mx";
$mail->Password = "UF+)8&;-(6Oy";
$mail->From = "robot@lition-sys.com.mx";
//$mail->Username = "robot@nesoftware.net";
//$mail->Password = "UF+)8&;-(6Oy";
//$mail->From = "robot@nesoftware.net";
$mail->FromName = "Robot Lition Logistics";
//El valor por defecto 10 de Timeout es un poco escaso dado que voy a usar
//una cuenta gratuita, por tanto lo pongo a 30
//$mail->Timeout=10;
$mail->Timeout = 10;
// --------------------
// FORMATO HTML
// --------------------
$mail->Body = "\r\n <html>\r\n <body>\r\n <font size=\"3\"><b>TEST EMAIL</b></font>\r\n <hr>\r\n <p>\r\n A quien corresponda : <br>\r\n <br>\r\n ++++++++ TEST / PRUEBA +++++++++\r\n <br>\r\n <i>\r\n Att. {$att} <br>\r\n </i>\r\n <p>\r\n <hr>\r\n <font color=\"red\" size=\"2\">\r\n <i>Este es un correo de envio automático generado por nuestro sistema {$dominio}, por favor no responda este email.<br></i>\r\n </font>\r\n <br>\r\n <br>\r\n <br>\r\n </body>\r\n </html>\r\n\r\n ";
// -------------------------------------------------------
// FORMATO TEXTO
// Definimos AltBody por si el destinatario del correo
// no admite email con formato html
// -------------------------------------------------------
$mail->AltBody = "\r\n =====================================================================\r\n ";
// Nota :
// La direccion PARA solo se puede manejar 1.
// Las direcciones CC puede manejar N correos.
// -------------
// Destinatarios
// -------------
$mail->ClearAddresses();
// ------------------------------------------------
// TO :
$mail->AddAddress("nestor@nesoftware.net");
// $mail->AddAddress ( "inventarios@lition.com.mx" );
// $mail->AddCC( "nestor@nesoftware.net" );
// $mail->AddCC( "nezmazter@gmail.com" );
// BCC :
//$mail->AddBCC("nperez@mscmexico.com");
// Subject :
$mail->Subject = "[EDI-CODECO][*Test] Naviera : {$naviera} ";
//Incluir Attach.
//$mail->AddAttachment($fileEDI,$fileName);
//$mail->AddAttachment($fileEDI,$fileName);
//$mail->AddAttachment($fileIN,$fileINOnlyName);
//$mail->AddAttachment($fileOUT,$fileOUTOnlyName);
// Se envia el mensaje, si no ha habido problemas, la variable $exito tendra el valor true
//if( is_array($arrEdiFile) ){
$exito = $mail->Send();
/*
// PARA INTAR REENVIARLO
//Si el mensaje no ha podido ser enviado se realizaran 4 intentos mas como mucho
//para intentar enviar el mensaje, cada intento se hara 5 segundos despues
//del anterior, para ello se usa la funcion sleep
$intentos=1;
while ((!$exito) && ($intentos < 5)) {
sleep(5);
$exito = $mail->Send();
$intentos=$intentos+1;
}
*/
if (!$exito) {
echo "[ <font color=red><b>Problema de envio</b></font> ] " . $mail->ErrorInfo . "<br>";
} else {
echo "[ <font color=green><b>OK, E-Mail enviado.</b></font> ] <br>";
}
// ---------------------------------------------------------
// ELIMINAR los archivos CSV una vez enviados.
// Nota : Ya no se eliminan por que primero se notifica via email
// y luego se transmite por FTP y ese proceso lo eliminará
// ---------------------------------------------------------
// unlink("$fileIN");
// unlink("$fileOUT");
//
}
示例13: sendMail
function sendMail($entryId)
{
global $objDatabase, $_ARRAYLANG, $_CORELANG, $_CONFIG;
//entrydata
$objResult = $objDatabase->Execute("SELECT id, title, name, userid, email FROM " . DBPREFIX . "module_market WHERE id='" . contrexx_addslashes($entryId) . "' LIMIT 1");
if ($objResult !== false) {
while (!$objResult->EOF) {
$entryMail = $objResult->fields['email'];
$entryName = $objResult->fields['name'];
$entryTitle = $objResult->fields['title'];
$entryUserid = $objResult->fields['userid'];
$objResult->MoveNext();
}
}
//assesuserdata
$objResult = $objDatabase->Execute("SELECT email, username FROM " . DBPREFIX . "access_users WHERE id='" . $entryUserid . "' LIMIT 1");
if ($objResult !== false) {
while (!$objResult->EOF) {
// TODO: Never used
// $userMail = $objResult->fields['email'];
$userUsername = $objResult->fields['username'];
$objResult->MoveNext();
}
}
//get mail content n title
$objResult = $objDatabase->Execute("SELECT title, content, active, mailcc FROM " . DBPREFIX . "module_market_mail WHERE id='1'");
if ($objResult !== false) {
while (!$objResult->EOF) {
$mailTitle = $objResult->fields['title'];
$mailContent = $objResult->fields['content'];
$mailCC = $objResult->fields['mailcc'];
$mailOn = $objResult->fields['active'];
$objResult->MoveNext();
}
}
if ($mailOn == 1) {
$array = explode('; ', $mailCC);
$url = $_SERVER['SERVER_NAME'] . ASCMS_PATH_OFFSET;
$link = "http://" . $url . "/index.php?section=Market&cmd=detail&id=" . $entryId;
$now = date(ASCMS_DATE_FORMAT);
//replase placeholder
$array_1 = array('[[EMAIL]]', '[[NAME]]', '[[TITLE]]', '[[ID]]', '[[LINK]]', '[[URL]]', '[[DATE]]', '[[USERNAME]]');
$array_2 = array($entryMail, $entryName, $entryTitle, $entryId, $link, $url, $now, $userUsername);
for ($x = 0; $x < 8; $x++) {
$mailTitle = str_replace($array_1[$x], $array_2[$x], $mailTitle);
}
for ($x = 0; $x < 8; $x++) {
$mailContent = str_replace($array_1[$x], $array_2[$x], $mailContent);
}
//create mail
$to = $entryMail;
$fromName = $_CONFIG['coreAdminName'] . " - " . $url;
$fromMail = $_CONFIG['coreAdminEmail'];
$subject = $mailTitle;
$message = $mailContent;
if (\Env::get('ClassLoader')->loadFile(ASCMS_LIBRARY_PATH . '/phpmailer/class.phpmailer.php')) {
$objMail = new \phpmailer();
if ($_CONFIG['coreSmtpServer'] > 0) {
if (($arrSmtp = \SmtpSettings::getSmtpAccount($_CONFIG['coreSmtpServer'])) !== false) {
$objMail->IsSMTP();
$objMail->Host = $arrSmtp['hostname'];
$objMail->Port = $arrSmtp['port'];
$objMail->SMTPAuth = true;
$objMail->Username = $arrSmtp['username'];
$objMail->Password = $arrSmtp['password'];
}
}
$objMail->CharSet = CONTREXX_CHARSET;
$objMail->SetFrom($fromMail, $fromName);
$objMail->Subject = $subject;
$objMail->IsHTML(false);
$objMail->Body = $message;
$objMail->AddAddress($to);
$objMail->Send();
$objMail->ClearAddresses();
foreach ($array as $toCC) {
// Email message
if (!empty($toCC)) {
$objMail->AddAddress($toCC);
$objMail->Send();
$objMail->ClearAddresses();
}
}
}
}
}
示例14: sendMassMail
function sendMassMail($subject, $body, $cname, $emailto)
{
global $smtp_host, $smtp_port, $admin_name, $admin_email;
include_once "include/phpmailer/class.phpmailer.php";
$mail = new phpmailer();
$mail->CharSet = "utf-8";
$mail->IsHTML(true);
$mail->Host = $smtp_host;
$mail->Port = $smtp_port;
$mail->Mailer = "smtp";
$mail->From = $admin_email;
$mail->FromName = $admin_name;
$mail->Subject = $subject;
$mail->Body = "<html><body>" . stripcslashes($body) . "</body></html>";
$mail->AddAddress($emailto, $cname);
$result = $mail->Send();
// Clear all addresses and attachments for next loop
$mail->ClearAddresses();
return $result;
}
示例15: notifyByEmail
/**
* This functions performs the email notifications
*
* @return boolean
*/
protected function notifyByEmail()
{
$userlist = array();
// find all the users with this server listed
$users = $this->db->select(SM_DB_PREFIX . 'users', 'FIND_IN_SET(\'' . $this->server['server_id'] . '\', `server_id`) AND `email` != \'\'', array('user_id', 'name', 'email'));
if (empty($users)) {
return false;
}
// build mail object with some default values
$mail = new phpmailer();
$mail->From = sm_get_conf('email_from_email');
$mail->FromName = sm_get_conf('email_from_name');
$mail->Subject = sm_parse_msg($this->status_new, 'email_subject', $this->server);
$mail->Priority = 1;
$body = sm_parse_msg($this->status_new, 'email_body', $this->server);
$mail->Body = $body;
$mail->AltBody = str_replace('<br/>', "\n", $body);
// go through empl
foreach ($users as $user) {
// we sent a seperate email to every single user.
$userlist[] = $user['user_id'];
$mail->AddAddress($user['email'], $user['name']);
$mail->Send();
$mail->ClearAddresses();
}
if (sm_get_conf('log_email')) {
// save to log
sm_add_log($this->server['server_id'], 'email', $body, implode(',', $userlist));
}
}