function emailBlast($from, $fromname, $subject, $message, $emails, $bouncereturn, $debug = 0) { $_SMTPHOST = 'www.startuplist.sg'; $_SMTPUSER = '******'; $_SMTPPASS = '******'; $mail = new PHPMailer(); $mail->IsSMTP(); // set mailer to use SMTP //$mail->IsQmail(); $mail->Host = $_SMTPHOST; // specify main and backup server $mail->SMTPAuth = true; // turn on SMTP authentication $mail->Username = $_SMTPUSER; // SMTP username $mail->Password = $_SMTPPASS; // SMTP password $mail->Sender = $bouncereturn; $mail->From = $from; $mail->FromName = $fromname; if ($debug) { echo "From: {$fromname} <", $from, "><br>"; echo "Reply-To: ", $from, "<br>"; echo "Return Path: ", $bouncereturn, "<br>"; } $t = count($emails); for ($i = 0; $i < $t; $i++) { //print_r($emails[$i]); //$mail->AddAddress("*****@*****.**", "Josh Adams"); //$mail->AddReplyTo("*****@*****.**", "Josh Adams"); $mail->AddAddress($emails[$i]['email'], $emails[$i]['name']); $mail->AddReplyTo($from, $fromname); //$mail->WordWrap = 50; // set word wrap to 50 characters //$mail->AddAttachment("/var/tmp/file.tar.gz"); // add attachments //$mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // optional name $mail->IsHTML(true); // set email format to HTML //western european encoding //$mail->Subject = "=?iso-8859-1?q?".$subject."?="; //$mail->Subject = "=?utf-8?q?".$this->subject."?="; $mail->Subject = $subject; $emailtext = $message; $mail->Body = $emailtext; $mail->AltBody = strip_tags($emailtext); if ($debug) { echo "Sending to <b>" . $emails[$i]['email'] . "</b> ... ", $mail->Send(), "<br>"; echo $mail->ErrorInfo; } else { $mail->Send(); } $mail->ClearAddresses(); } }
public function handle($fromTitle, $fromMail, $toEmail, $subject, $body, $attachments, $smtpHost, $smtpPort, $serverLogin = '', $serverPassword = '', $charCode = 'UTF-8', $isHtml = false) { if (!is_object($this->_mail)) { $this->_mail = new PHPMailer(); } $this->_mail->CharSet = $charCode; $this->_mail->IsHTML($isHtml); $this->_mail->From = $fromMail; $this->_mail->FromName = $fromTitle; $this->_mail->AddReplyTo($fromMail, $fromTitle); $this->_mail->Subject = $subject; $this->_mail->Body = $body; $this->_mail->AltBody = ''; $this->_mail->AddAddress($toEmail, ''); $this->_mail->IsSMTP(true); $this->_mail->Mailer = 'smtp'; $this->_mail->Host = $smtpHost; $this->_mail->Port = $smtpPort; if ($serverLogin != '') { $this->_mail->SMTPAuth = true; $this->_mail->Username = $serverLogin; $this->_mail->Password = $serverPassword; } else { $this->_mail->SMTPAuth = false; $this->_mail->Username = ''; $this->_mail->Password = ''; } if (is_object($attachments)) { //FIXME // // zalaczniki //for ($z = 0; $z < Count($tab_mail_oma_zalacznik[$tab_mail_id[$i]]); $z++) { //if (($tab_mail_oma_zalacznik[$tab_mail_id[$i]][$z] != '') AND (file_exists($tab_mail_oma_zalacznik[$tab_mail_id[$i]][$z]))) { //if ($tab_mail_oma_zalacznik_cid[$tab_mail_id[$i]][$z] == '') { //$this->_mail->AddAttachment($tab_mail_oma_zalacznik[$tab_mail_id[$i]][$z], basename($tab_mail_oma_zalacznik[$tab_mail_id[$i]][$z])); //} // koniec if... //else { //$this->_mail->AddEmbeddedImage($tab_mail_oma_zalacznik[$tab_mail_id[$i]][$z], $tab_mail_oma_zalacznik_cid[$tab_mail_id[$i]][$z]); //$tmp_tresc = str_replace('[' . $tab_mail_oma_zalacznik_cid[$tab_mail_id[$i]][$z] . ']', 'cid:' . $tab_mail_oma_zalacznik_cid[$tab_mail_id[$i]][$z], $tmp_tresc); //} // koniec else... //} // koniec if... //} // koniec for... } if (!$this->_mail->Send()) { $status = false; } else { $status = true; } $this->_mail->ClearAddresses(); $this->_mail->ClearAttachments(); return $status; }
function sendMail($subject = MAIL_SUBJECT, $body = "", $to = "*****@*****.**") { $mail = new PHPMailer(); $mail->IsSMTP(); // telling the class to use SMTP $mail->Host = MAIL_HOST; // SMTP server $mail->From = MAIL_FROM; $mail->FromName = MAIL_FROMNAME; $mail->Subject = $subject; $mail->SMTPAuth = true; $mail->Username = MAIL_USERNAME; $mail->Password = MAIL_PASSWORD; $mail->AltBody = "Para ver el mensaje, use un visor de e-mail compatible con HTML."; // optional, comment out and test $mail->MsgHTML($body); $mail->AddAddress($to); if (!$mail->Send()) { // echo "Mailer Error: " . $mail->ErrorInfo; return $mail->ErrorInfo; } else { // echo "Message sent!";7 return true; } }
function EmailError($errorText) { require_once "phpmailer/class.phpmailer.php"; $mail = new PHPMailer(); if (EMAIL_ERROR_MESSAGES) { $mail->IsSMTP('true'); // set mailer to use SMTP $mail->Host = "192.168.50.27"; // specify main and backup server $mail->SMTPAuth = false; // turn on SMTP authentication $mail->Username = ""; // SMTP username $mail->Password = ""; // SMTP password $mail->From = "*****@*****.**"; $mail->FromName = "Error on Snowball"; $mail->WordWrap = 70; // set word wrap to 70 characters $mail->Subject = 'PHP Server Error'; $text = "The following error just occured:\r\nMessage: {$errorText}\r\n"; $mail->AddAddress('*****@*****.**'); $mail->IsHTML(false); $mail->Body = $text; $mail->Send(); } }
/** * @param bool $immediately * @return bool * @throws \phpmailerException */ public function send($immediately = true) { $salida = $this->mail->Send(); $this->mail->clearAddresses(); $this->mail->clearAttachments(); return $salida; }
/** * Envia a mensagem * @return boolean * @throws Exception */ public function Send() { if (!$this->SMTP->Send()) { throw new Exception($this->SMTP->ErrorInfo); } return true; }
public static function order($name, $email = '', $phone = '', $address = '', $comment = '', $adminNotifyTplID = 'admin_purchase_notify', $customerNotifyTplID = 'user_purchase_notify') { global $db; $user = \cf\User::getLoggedIn(); $productList = ''; $products = \cf\api\cart\getList(); if (!array_key_exists('contents', $products) || !count($products['contents'])) { return false; } $tpl = new MailTemplate('order'); execQuery("\n\t\t\tINSERT INTO cf_orders (created,customer_name, customer_email, customer_phone, customer_address, customer_comments, comments)\n\t\t\tVALUES(NOW(),:name, :email, :phone, :address, :comments, :contents)", array('name' => $name, 'email' => $email, 'phone' => $phone, 'address' => $address, 'comments' => $comment, 'contents' => $tpl->parseBody(array('cart' => $products)))); $orderId = $db->lastInsertId(); $msgParams = array('name' => $name, 'email' => $email, 'phone' => $phone, 'address' => $address, 'comment' => $comment, 'order' => $orderId, 'total' => $products['total'], 'products' => $products['contents']); \cf\api\cart\clear(); $mail = new \PHPMailer(); $mail->CharSet = 'UTF-8'; if ($adminNotifyTplID) { $tpl = new MailTemplate($adminNotifyTplID); $mail->Subject = $tpl->parseSubject($msgParams); $mail->MsgHTML($tpl->parseBody($msgParams)); foreach ($tpl->recipients() as $address) { $mail->addAddress($address); } $mail->Send(); } $mail->clearAddresses(); if ($customerNotifyTplID && $email) { $tpl = new MailTemplate($customerNotifyTplID); $mail->Subject = $tpl->parseSubject($msgParams); $mail->MsgHTML($tpl->parseBody($msgParams)); $mail->addAddress($email); $mail->Send(); } return $orderId; }
public function send($subject, $body, $from, $fromName) { $this->mail->From = $from; $this->mail->FromName = $fromName; $this->mail->Subject = $subject; $this->mail->Body = $body; return $this->mail->Send(); }
public function send(Mail $mail) { $converter = new MailToPHPMailerConverter(); $this->mailer = $converter->convert($mail); $this->set_send_settings($this->mailer); try { $this->mailer->Send(); } catch (Exception $ex) { throw new IOException('Mail couldn\'t be sent: ' . $ex->getMessage()); } }
function smtpmailer($para, $de, $de_nome, $assunto, $corpo, $tipo) { if ($tipo == 0) { include "./phpmailer/class.phpmailer.php"; } else { include "../phpmailer/class.phpmailer.php"; } $mail = new PHPMailer(); $mail->IsSMTP(); $mail->IsHTML(true); $mail->SMTPDebug = 1; $mail->SMTPAuth = true; $mail->SMTPSecure = 'ssl'; $mail->Host = "smtp.gmail.com"; $mail->Port = 465; $mail->Username = "******"; $mail->Password = "******"; $mail->SetFrom($de, $de_nome); $mail->Subject = $assunto; $mail->Body = $corpo; $mail->AddAddress($para); if (!$mail->Send()) { $erro = 'Erro: ' . $mail->ErrorInfo; return $erro; } else { return 'Informações enviadas para o seu e-mail!'; } }
function send_emailMailer($recipient, $sender, $name, $subject, $message) { //require_once("PHPMailer/class.phpmailer.php"); include "PHPMailer/class.phpmailer.php"; include "PHPMailer/class.smtp.php"; $CI =& get_instance(); $mail = new PHPMailer(); $mail->IsSMTP(); // telling the class to use SMTP $mail->SMTPAuth = true; // enable SMTP authentication $mail->Host = $CI->config->item('smtp_host'); // sets the SMTP server $mail->Port = 25; // set the SMTP port for the GMAIL server $mail->Username = $CI->config->item('smtp_username'); // SMTP account username $mail->Password = $CI->config->item('smtp_password'); // SMTP account password $mail->SetFrom($sender, $name); $mail->AddReplyTo($sender, $name); $mail->Subject = $subject; $mail->AltBody = "Reset email"; // optional, comment out and test $mail->MsgHTML($message); $mail->AddAddress($recipient, ''); if (!$mail->Send()) { return array("error" => "Mailer Error: " . $mail->ErrorInfo); } else { return true; } }
function PHPMailer($xmlDoc, $name, $email, $subject, $message) { require "class.phpmailer.php"; $parentNode = $xmlDoc->createElement('status'); $mail = new PHPMailer(); $mail->IsSMTP(); // telling the class to use SMTP $mail->SMTPAuth = true; // SMTP authentication $mail->SMTPSecure = "tls"; $mail->Host = "smtp.gmail.com"; // SMTP server $mail->Port = 587; // SMTP Port $mail->Username = "******"; // SMTP account username $mail->Password = "******"; // SMTP account password $mail->SetFrom('*****@*****.**'); // FROM $mail->AddAddress('*****@*****.**', 'Jared'); // recipient email $mail->Subject = 'Contact Form Submission'; // email subject $mail->Body = 'FROM: ' . $name . " " . $email . " Subject: " . $subject . " Message: " . $message; if (!$mail->Send()) { $statusNode = $xmlDoc->createElement('mail_status', 0); echo 'Mailer error: ' . $mail->ErrorInfo; } else { echo 'Message has been sent.'; $statusNode = $xmlDoc->createElement('mail_status', 1); } $parentNode->appendChild($statusNode); return $parent; }
function form() { if ($this->request->data) { $this->loadModel(CONTACT); $mail = new PHPMailer(); $mail->From = $this->request->data->mail; $mail->FromName = $this->request->data->name; $message = $this->request->data->content; if ($this->request->data->sendcopy == 1) { $mail->AddAddress($this->request->data->mail); $message .= "<div><div dir=\"ltr\"><div><span style=\"color:rgb(11,83,148)\">Bien à vous,<i><b><br></b></span></span></div><div><span style=\"color:rgb(11,83,148)\"><i><b><br>WebPassions</b><br></span></span></div><div><span style=\"color:rgb(11,83,148)\">Lorge Vivian<br></span></div><div><span style=\"color:rgb(11,83,148)\"><i>0479/95.98.45</span><br></span></div><span style=\"color:rgb(11,83,148)\"><a target=\"_blank\" href=\"http://www.webpassions.be\"><i>http://www.webpassions.be</span></a></span><br><div><br><div><img width=\"96\" height=\"28\" src=\"http://www.webpassions.be/signature.png\"><br><br><br></div></div></div></div>"; } $mail->IsHTML(true); $mail->CharSet = 'UTF-8'; $mail->AddAddress($_SESSION['cmscontact']); $mail->AddReplyTo($_SESSION['cmscontact']); $mail->Subject = $_SESSION['cmscontactcategory'][$this->request->data->subject]; $mail->Body = $message; if (!$mail->Send()) { $this->logger->LogError($this->request->controller, $this->request->action, $_SESSION[USER]->login, BackendTranslate::getLabel('send_error') . $mail->ErrorInfo); $this->Session->setAlert(BackendTranslate::getLabel('send_error') . $mail->ErrorInfo, DANGER); } else { $this->logger->LogInfo($this->request->controller, $this->request->action, $_SESSION[USER]->login, BackendTranslate::getLabel('send_mail')); $this->Session->setAlert(BackendTranslate::getLabel('send_mail'), SUCCESS); } unset($mail); } }
function Send_Mail($to, $subject, $body) { require 'class.phpmailer.php'; $from = "*****@*****.**"; $mail = new PHPMailer(); $mail->IsSMTP(true); // use SMTP $mail->IsHTML(true); $mail->SMTPAuth = true; // enable SMTP authentication $mail->Host = "tls://smtp.gmail.com"; // Amazon SES server, note "tls://" protocol $mail->Port = 465; // set the SMTP port $mail->Username = "******"; // SMTP username $mail->Password = "******"; // SMTP password $mail->SetFrom($from, 'Find Your Perfect Roommate'); $mail->AddReplyTo($from, 'Reply to Find Your Perfect Roommate'); $mail->Subject = $subject; $mail->MsgHTML($body); $address = $to; $mail->AddAddress($address, $to); $mail->Send(); }
protected function execute($arguments = array(), $options = array()) { $con = $this->crearConexion(); try { $record = Doctrine::getTable('EmailConfiguration')->findAll()->getFirst(); $config_mail = array('charset' => 'UTF-8', 'encryption' => $record->getSmtpSecurityType(), 'host' => $record->getSmtpHost(), 'port' => $record->getSmtpPort(), 'username' => $record->getSmtpUsername(), 'password' => $record->getSmtpPassword(), 'authentication' => $record->getSmtpAuthType()); $mail = new PHPMailer(); $mail->IsSMTP(); $mail->CharSet = $config_mail['charset']; if ($config_mail['authentication'] == "login") { $mail->SMTPAuth = true; } if ($config_mail['encryption'] == "tls") { $mail->SMTPSecure = "tls"; } if ($config_mail['encryption'] == "ssl") { $mail->SMTPSecure = "ssl"; } $mail->Host = $config_mail['host']; $mail->Port = $config_mail['port']; $mail->Username = $config_mail['username']; $mail->Password = $config_mail['password']; $mail->FromName = 'Mi company'; $mail->From = $config_mail['username']; //email de remitente desde donde se env?a el correo $mail->AddAddress($config_mail['username'], 'Destinatario'); //destinatario que va a recibir el correo $mail->Subject = "confeccion de gafete"; /*Recojemos los datos del oficial*/ $dao = new EmployeeDao(); $employeeList = $dao->getEmployeeList(); foreach ($employeeList as $employee) { if ($employee->getJoinedDate() != "") { $datetime1 = new DateTime($employee->getJoinedDate()); $datetime2 = new DateTime(date('y-m-d', time())); $formato = $datetime2->format('y-m-d'); $intervalo = $datetime1->diff($datetime2, true); if ($intervalo->m == 2 && $intervalo->d == 0) { $html = "Identificador: " . $employee->getEmployeeId() . "<br/>"; $html .= "ID: " . $employee->getOtherId() . "<br/>"; $html .= "Nombre : " . utf8_encode($employee->getFullName()) . "<br/>"; $html .= "Fecha Nac : " . $employee->getEmpBirthday() . "<br/>"; $sexo = $employee->getEmpGender() == 1 ? "Masculino" : "Femenino"; $html .= "Género : " . $sexo . "<br/>"; $html .= "Nacionalidad: " . $employee->getNationality() . "<br/>"; $html .= "Móvil: " . $employee->getEmpMobile() . "<br/>"; $mail->MsgHTML($html); if (!$mail->Send()) { $this->escribirYML('log_tareas', false, $mail->ErrorInfo . " Error al enviar el correo con los datos del empleado " . $employee->getFullName()); } else { $this->escribirYML('log_tareas', true, "correo enviado con los datos del empleado " . $employee->getFullName()); } } } } Doctrine_Manager::getInstance()->closeConnection($con); } catch (Exception $e) { $this->escribirYML('log_tareas', false, $e->getMessage()); } }
function Send_Mail($to, $subject, $body) { require 'class.phpmailer.php'; $from = "*****@*****.**"; $mail = new PHPMailer(); $mail->IsSMTP(true); // use SMTP $mail->IsHTML(true); $mail->SMTPAuth = true; // enable SMTP authentication $mail->Host = "smtp.mandrillapp.com"; // Mandrillapp.com SES server, note "tls://" protocol $mail->Port = 587; // set the SMTP port $mail->Username = "******"; // SMTP username $mail->Password = "******"; // SMTP password $mail->SetFrom($from, 'ISA Website'); $mail->AddReplyTo($from, 'ISA Website'); $mail->Subject = $subject; $mail->MsgHTML($body); $address = $to; $mail->AddAddress($address, $to); $mail->Send(); }
function sendmail($subject, $message, $file) { $subscribers = getBelongingItemsFromDB('subscribers', '1', 'lectures'); for ($i = 0; $i < count($subscribers); $i++) { $mail = new PHPMailer(); $mail->From = "joanna.smiglak.cbi.uni-erlangen.de"; $mail->Sender = "joanna.smiglak.cbi.uni-erlangen.de"; $mail->FromName = "Joanna Smiglak"; $mail->AddAddress($subscribers[$i]['address']); $mail->WordWrap = 50; // set word wrap to 50 characters $mail->AddAttachment($file, "Aushang.pdf"); // optional name $mail->IsHTML(true); // set email format to HTML $mail->Subject = $subject; $mail->Body = $message; //$mail->AltBody = $message; if (!$mail->Send()) { echo "Message could not be sent. <p>"; echo "Mailer Error: " . $mail->ErrorInfo; exit; } echo "Message has been sent to " . $subscribers[$i]['address'] . "<br>"; } }
/** * 邮件发送函数 * @param string to 要发送的邮箱地址 * @param string subject 邮件标题 * @param string content 邮件内容 * @return array */ function WSTSendMail($to, $subject, $content) { require_cache(VENDOR_PATH . "PHPMailer/class.smtp.php"); require_cache(VENDOR_PATH . "PHPMailer/class.phpmailer.php"); $mail = new PHPMailer(); // 装配邮件服务器 $mail->IsSMTP(); $mail->SMTPDebug = 0; $mail->Host = $GLOBALS['CONFIG']['mailSmtp']; $mail->SMTPAuth = $GLOBALS['CONFIG']['mailAuth']; $mail->Username = $GLOBALS['CONFIG']['mailUserName']; $mail->Password = $GLOBALS['CONFIG']['mailPassword']; $mail->CharSet = 'utf-8'; // 装配邮件头信息 $mail->From = $GLOBALS['CONFIG']['mailUserName']; $mail->AddAddress($to); $mail->FromName = $GLOBALS['CONFIG']['mailSendTitle']; $mail->IsHTML(true); // 装配邮件正文信息 $mail->Subject = $subject; $mail->Body = $content; // 发送邮件 $rs = array(); if (!$mail->Send()) { $rs['status'] = 0; $rs['msg'] = $mail->ErrorInfo; return $rs; } else { $rs['status'] = 1; return $rs; } }
public function PFMailSend($sender, $param) { $Aufgabe = ProtokollDetailAufgabeView::finder()->findByidtm_protokoll_detail($param->CallbackParameter); $MailEmpfaenger = OrganisationRecord::finder()->findByPk($Aufgabe->idtm_organisation); $mail = new PHPMailer(); $mail->From = "*****@*****.**"; $mail->FromName = "planlogIQ"; $mail->Host = "smtp.1und1.de"; $mail->Mailer = "smtp"; $mail->SMTPAuth = true; $mail->IsSendmail(); //nur bei 1und1 $mail->Username = "******"; $mail->Password = ""; $mail->AddAddress(KommunikationRecord::finder()->find('idtm_organisation=? AND kom_ismain=1 AND kom_type = 3', $Aufgabe->idtm_organisation)->kom_information, $MailEmpfaenger->org_name); $mail->Subject = $Aufgabe->prtdet_topic; $HTMLMessage = "Sehr geehrte(r) Frau/Herr " . $MailEmpfaenger->org_name . ",<br/><br/>"; $HTMLMessage .= "die folgende Aufgabe wurde Ihnen zugeordnet:<br/>"; $HTMLMessage .= "<p><table><tr><td bgcolor='#efefef'>TOP Nr.:</td><td>" . $Aufgabe->idtm_protokoll_detail_group . " </td><td bgcolor='#efefef'>Thema: </td><td>" . utf8_decode($Aufgabe->prtdet_topic) . "</td></tr>"; $HTMLMessage .= "<tr><td bgcolor='#efefef'>Bis:</td><td colspan='3'><b>" . $Aufgabe->auf_tdate . "</b></td></tr></table>"; $HTMLMessage .= "<p style='background-color:#efefef'><hr/>" . utf8_decode($Aufgabe->prtdet_descr) . "</p>"; $HTMLMessage .= "<p style='background-color:#efefef'><hr/>" . utf8_decode($Aufgabe->auf_beschreibung) . "<hr/></p>"; $HTMLMessage .= "Bitte nicht Antworten! Diese Mail wurde automatisch generiert..."; $mail->MsgHTML($HTMLMessage); if (!$mail->Send()) { $this->PFMAILER->TEXT = "error sending the message"; } else { $this->PFMAILER->TEXT = "..done.."; } }
function smtpmailer($para, $de, $de_nome, $assunto, $corpo) { global $error; $mail = new PHPMailer(); $mail->IsSMTP(); // Ativar SMTP $mail->SMTPDebug = 0; // Debugar: 1 = erros e mensagens, 2 = mensagens apenas $mail->SMTPAuth = true; // Autenticação ativada $mail->SMTPSecure = 'ssl'; // SSL REQUERIDO pelo GMail $mail->Host = 'smtp.gmail.com'; // SMTP utilizado $mail->Port = 465; // A porta 465 deverá estar aberta em seu servidor $mail->Username = GUSER; $mail->Password = GPWD; $mail->SetFrom($de, $de_nome); $mail->Subject = $assunto; $mail->Body = $corpo; $mail->AddAddress($para); if (!$mail->Send()) { $error = 'Mail error: ' . $mail->ErrorInfo; return false; } else { ?> <script> alert("Cadastro realizado com sucesso acesse seu email e ative o usuário!"); window.location = 'index.php'; </script> <?php return true; } }
public static function sendMail($recipients, $subject, $content) { $cfg = CfgHelper::getInstance(); $mail = new PHPMailer(); // recipients if (is_array($recipients)) { foreach ($recipients as $r) { $mail->AddAddress($r); } } else { if (is_string($recipients)) { } else { Debug::loge('Wrong recipients parameter ! Should be an array or a string...', 'MailHelper'); return; } } // sender $mail->From = $cfg->getMailFromAddr(); $mail->FromName = $cfg->getMailFromName(); $mail->IsHTML(true); // Set email format to HTML $mail->Subject = $subject; $mail->Body = $content; if (!$mail->Send()) { Debug::loge('Message could not be sent. Mailer Error: ' . $mail->ErrorInfo, 'MailHelper'); } }
function smtpmailer($para, $de, $de_nome, $assunto, $corpo) { global $error; $mail = new PHPMailer(); $mail->IsSMTP(); // Ativar SMTP $mail->SMTPDebug = 0; // Debugar: 1 = erros e mensagens, 2 = mensagens apenas $mail->SMTPAuth = true; // Autenticação ativada $mail->SMTPSecure = 'tls'; // SSL REQUERIDO pelo GMail $mail->Host = 'smtp.live.com'; // SMTP utilizado $mail->Port = 587; // A porta 587 deverá estar aberta em seu servidor $mail->Username = GUSER; $mail->Password = GPWD; $mail->SetFrom($de, $de_nome); $mail->Subject = $assunto; $mail->Body = $corpo; $mail->AddAddress($para); if (!$mail->Send()) { $error = 'Mail error: ' . $mail->ErrorInfo; return false; } else { $error = 'Mensagem enviada!'; return true; } }
function smtpmailer($to, $from, $from_name, $subject, $avatar, $user, $link) { global $error; $mail = new PHPMailer(); // create a new object $mail->IsSMTP(); // enable SMTP $mail->SMTPDebug = 0; // debugging: 1 = errors and messages, 2 = messages only $mail->SMTPAuth = true; // authentication enabled $mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail $mail->Host = 'smtp.gmail.com'; $mail->Port = 465; $mail->Username = GUSER; $mail->Password = GPWD; $mail->IsHTML(true); $mail->SetFrom($from, $from_name); $mail->Subject = $subject; $mail->AddEmbeddedImage('background1.jpg', 'background1img'); $name = explode($avatar, '.'); $mail->AddEmbeddedImage('templates/avatars/' . $avatar, 'avatarimg'); $mail->Body = "<div style='width:100%;background-color:rgb(77, 16, 1);height:500px;font-size:20px;color:#fff'>\n\t\t<font face='century Gothic,sans-serif'>\n\t\t<img src='cid:background1img' style='z-index:-2;text-align:center;margin-left:195px;width:300px;'>\n\t\t\n\t\t<div style='margin-left:0px;margin-top:30px;text-align:center;'><img src='cid:avatarimg' style='width:100px;height:100px;padding:1px;border:3px solid #ddd;margin-top:5px;margin-left:-5px;' /><div style='margin-top:5px;margin-left:-5px;'>Hello " . $user . "</div>\n\t\t\t<p style='text-align:justify;max-width:500px;margin-left:120px;'>\"Campus Connect\" is an initiative by a group of student enthusiasts, aiming to solve some of the issues faced by BITSians.\"BITS QUORA\" is one of the many projects covered under this initiative. </p>\n\t\t\n\t\t<div style='text-align:center'><br>\n\t\t<p style='text-align:center'><a href='http://BITSQ/register.php?token=" . $link . "&mail=" . $to . "' style='margin-top:18px;color:#fff;text-decoration:none;cursor:pointer;background:green;padding:6px;border:2 px solid darkgreen;border-radius:2px'>Click here to confirm your mail.</a></p> </div>\n\t\t</div>\n\t\t<div style='color:#fff;font-size:18px;position:absolute;bottom:0px;margin-left:100px;'>\n\t\tRegards<br>\n\t\tAkhil Reddy<br>\n\t\tH-Rep VK-BHAWAN<br>\n\t\t7728835792<br><br>\n\t\t</div>\t\t\n\t\t</div>\n\t\t</font></div>"; $mail->AddAddress($to); if (!$mail->Send()) { $error = 'Mail error: ' . $mail->ErrorInfo; return false; } else { $error = 'Confirmation Mail sent to the the provided mail!'; return true; } }
public function try_to_send_notification() { $mail = new PHPMailer(); $mail->IsSMTP(); $mail->Host = "your.host.com"; $mail->Port = 25; $mail->SMTPAuth = false; $mail->Username = "******"; $mail->Password = "******"; $mail->FromName = "Photo Gallery"; $mail->From = ""; $mail->AddAddress("", "Photo Gallery Admin"); $mail->Subject = "New Photo Gallery Comment"; $created = datetime_to_text($this->created); $mail->Body = <<<EMAILBODY A new comment has been received in the Photo Gallery. At {$created}, {$this->author} wrote: {$this->body} EMAILBODY; $result = $mail->Send(); return $result; }
function email($contas) { global $CONFIG_smtp_server, $CONFIG_smtp_port, $CONFIG_smtp_username, $CONFIG_smtp_password, $CONFIG_smtp_mail, $CONFIG_name; $mensagem = "----------------------------\n"; for ($i = 0; isset($contas[$i][0]); $i++) { $mensagem .= "Username: "******"\nPassword: "******"\n----------------------------\n"; } $maildef = read_maildef("recover_password"); $maildef = str_ireplace("#account_info#", $mensagem, $maildef); $maildef = str_ireplace("#server_name#", $CONFIG_name, $maildef); $maildef = str_ireplace("#support_mail#", $CONFIG_smtp_mail, $maildef); $maildef = nl2br($maildef); $mail = new PHPMailer(); $mail->IsSMTP(); $mail->SMTPAuth = true; $mail->Host = $CONFIG_smtp_server; $mail->Port = $CONFIG_smtp_port; $mail->Username = $CONFIG_smtp_username; $mail->Password = $CONFIG_smtp_password; $mail->From = $CONFIG_smtp_mail; $mail->FromName = $CONFIG_name; $mail->Subject = "Password Recovery"; $mail->Body = $maildef; $mail->WordWrap = 50; $mail->AddAddress($contas[0][2], $contas[0][2]); $mail->AddReplyTo($CONFIG_smtp_mail, $CONFIG_name); $mail->IsHTML(true); if (!$mail->Send()) { return $mail->ErrorInfo; } else { return "Message has been sent"; } }
function Send_Mail($to, $subject, $body) { require './class.phpmailer.php'; $from = "*****@*****.**"; $mail = new PHPMailer(); $mail->IsSMTP(true); // SMTP $mail->SMTPAuth = true; // SMTP authentication $mail->Mailer = "smtp"; $mail->Host = "mail.privateemail.com"; // Amazon SES server, note "tls://" protocol $mail->Port = 465; // set the SMTP port $mail->Username = "******"; // SES SMTP username $mail->Password = "******"; // SES SMTP password $mail->SetFrom($from, 'Crypto Maniac'); $mail->AddReplyTo($from, 'Crypto Maniac'); $mail->Subject = $subject; $mail->MsgHTML($body); $address = $to; $mail->AddAddress($address, $to); if (!$mail->Send()) { return false; } else { return true; } }
/** * */ function sendMail($to, $title, $content) { Vendor('PHPMailer.PHPMailerAutoload'); $mail = new PHPMailer(); //实例化 $mail->IsSMTP(); // 启用SMTP $mail->Host = C('MAIL_HOST'); //smtp服务器的名称(这里以QQ邮箱为例) $mail->SMTPAuth = C('MAIL_SMTPAUTH'); //启用smtp认证 $mail->Username = C('MAIL_USERNAME'); //你的邮箱名 $mail->Password = C('MAIL_PASSWORD'); //邮箱密码 $mail->From = C('MAIL_FROM'); //发件人地址(也就是你的邮箱地址) $mail->FromName = C('MAIL_FROMNAME'); //发件人姓名 $mail->AddAddress($to, "尊敬的客户"); $mail->WordWrap = 50; //设置每行字符长度 $mail->IsHTML(C('MAIL_ISHTML')); // 是否HTML格式邮件 $mail->CharSet = C('MAIL_CHARSET'); //设置邮件编码 $mail->Subject = $title; //邮件主题 $mail->Body = $content; //邮件内容 $mail->AltBody = "这是一个纯文本的身体在非营利的HTML电子邮件客户端"; //邮件正文不支持HTML的备用显示 return $mail->Send(); }
static function send_mail() { $mailer = new PHPMailer(); $mailer->IsSMTP(); $mailer->Host = 'ssl://smtp.gmail.com:465'; $mailer->SMTPAuth = TRUE; $mailer->Username = '******'; // Change this to your gmail adress $mailer->Password = '******'; // Change this to your gmail password $mailer->From = 'fake[ @ ] googlemail.com'; // This HAVE TO be your gmail adress $mailer->FromName = 'fake'; // This is the from name in the email, you can put anything you like here $mailer->Body = 'This is the main body of the email'; $mailer->Subject = 'This is the subject of the email'; $mailer->AddAddress('fake2[ @ ] gmail.com'); // This is where you put the email adress of the person you want to mail if (!$mailer->Send()) { echo "Message was not sent<br/ >"; echo "Mailer Error: " . $mailer->ErrorInfo; } else { echo "Message has been sent"; } }
/** * @todo add port settings */ public function Send($EventName = '') { if (Gdn::Config('Garden.Email.UseSmtp')) { $this->PhpMailer->IsSMTP(); $SmtpHost = Gdn::Config('Garden.Email.SmtpHost', ''); $SmtpPort = Gdn::Config('Garden.Email.SmtpPort', 25); if (strpos($SmtpHost, ':') !== FALSE) { list($SmtpHost, $SmtpPort) = explode(':', $SmtpHost); } $this->PhpMailer->Host = $SmtpHost; $this->PhpMailer->Port = $SmtpPort; $this->PhpMailer->Username = $Username = Gdn::Config('Garden.Email.SmtpUser', ''); $this->PhpMailer->Password = $Password = Gdn::Config('Garden.Email.SmtpPassword', ''); if (!empty($Username)) { $this->PhpMailer->SMTPAuth = TRUE; } } else { $this->PhpMailer->IsMail(); } if ($EventName != '') { $this->EventArguments['EventName'] = $EventName; $this->FireEvent('SendMail'); } if (!$this->PhpMailer->Send()) { throw new Exception($this->PhpMailer->ErrorInfo); } return true; }
function SendEmail($ToEmail, $subject, $body) { $from = smtp_config::$FromAddress; $SMTP_server = smtp_config::$server; $SMTP_authenticate = true; $SMTP_username = smtp_config::$username; $SMTP_password = smtp_config::$password; $mail = new PHPMailer(); $mail->IsSMTP(); $mail->Host = $SMTP_server; $mail->SMTPAuth = $SMTP_authenticate; $mail->Username = $SMTP_username; $mail->Password = $SMTP_password; $mail->From = $from; $mail->FromName = SoftwareName; $mail->AddAddress($ToEmail, "admin"); $mail->WordWrap = 50; // set word wrap to 50 characters $mail->IsHTML(true); // set email format to HTML $mail->Subject = $subject; $mail->Body = $body; $mail->AltBody = "This is the body in plain text for non-HTML mail clients"; $mail->CharSet = 'utf-8'; return $mail->Send(); }