/** * Tests removal of duplicate recipients and reply-tos. */ public function testDuplicateIDNRemoved() { if (!$this->Mail->idnSupported()) { $this->markTestSkipped('intl and/or mbstring extensions are not available'); } $this->Mail->clearAllRecipients(); $this->Mail->clearReplyTos(); $this->Mail->CharSet = 'utf-8'; $this->assertTrue($this->Mail->addAddress('test@françois.ch')); $this->assertFalse($this->Mail->addAddress('test@françois.ch')); $this->assertTrue($this->Mail->addAddress('test@FRANÇOIS.CH')); $this->assertFalse($this->Mail->addAddress('test@FRANÇOIS.CH')); $this->assertTrue($this->Mail->addAddress('*****@*****.**')); $this->assertFalse($this->Mail->addAddress('*****@*****.**')); $this->assertFalse($this->Mail->addAddress('*****@*****.**')); $this->assertTrue($this->Mail->addReplyTo('test+replyto@françois.ch')); $this->assertFalse($this->Mail->addReplyTo('test+replyto@françois.ch')); $this->assertTrue($this->Mail->addReplyTo('test+replyto@FRANÇOIS.CH')); $this->assertFalse($this->Mail->addReplyTo('test+replyto@FRANÇOIS.CH')); $this->assertTrue($this->Mail->addReplyTo('*****@*****.**')); $this->assertFalse($this->Mail->addReplyTo('*****@*****.**')); $this->assertFalse($this->Mail->addReplyTo('*****@*****.**')); $this->buildBody(); $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); // There should be only one "To" address and one "Reply-To" address. $this->assertEquals(1, count($this->Mail->getToAddresses()), 'Bad count of "to" recipients'); $this->assertEquals(1, count($this->Mail->getReplyToAddresses()), 'Bad count of "reply-to" addresses'); }
function send() { $conf = $this->smtp; $mail = new PHPMailer(); $mail->IsSMTP(false); //$mail->Host = $conf['host']; //$mail->SMTPAuth = true; $mail->IsHTML(true); //$mail->SMTPDebug = 2; //$mail->Port = $conf['port']; //$mail->Username = $conf['user']; //$mail->Password = $conf['pass']; //$mail->SMTPSecure = 'tls'; $mail->setFrom($this->from, 'Onboarding Mail'); $mail->addReplyTo($this->from, 'Onboarding Mail'); $mail->addAddress($this->to); foreach ($this->attachment as $k => $att) { $num = $k + 1; $fname = "Events{$num}_" . date('h:i:s') . ".ics"; $mail->AddStringAttachment($att, $fname, 'base64', 'text/ics'); } $mail->Subject = $this->subject; $mail->Body = $this->bodyText; if (!$mail->send()) { echo '<pre>'; echo 'Message could not be sent.<br>'; echo 'Mailer Error: ' . $mail->ErrorInfo; exit; } }
private function _setupMailer() { $this->_mailer = new PHPMailer(); //$this->_mailer->SMTPDebug = 3; // Enable verbose debug output $this->_mailer->isSMTP(); // Set mailer to use SMTP $this->_mailer->Host = 'mx1.hostinger.ro'; // Specify main and backup SMTP servers $this->_mailer->SMTPAuth = true; // Enable SMTP authentication $this->_mailer->Username = '******'; // SMTP username $this->_mailer->Password = '******'; // SMTP password $this->_mailer->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted $this->_mailer->Port = 587; // TCP port to connect to $this->_mailer->isHTML(true); // Set email format to HTML $this->_mailer->From = '*****@*****.**'; $this->_mailer->FromName = 'Mailer'; $this->_mailer->addAddress('*****@*****.**', 'Cristi'); // Add a recipient $this->_mailer->addReplyTo('*****@*****.**', 'Auto Mailer'); }
public static function SendMail($from, $to, $subject, $content, $isHTML = false) { $mail = new PHPMailer(); $mail->isSMTP(); $mail->Host = 'relay.proximus.be'; if (is_array($from)) { $mail->From = array_values(array_shift(array_values($from))); $mail->FromName = array_values(array_shift(array_keys($from))); } else { $mail->From = $from; $mail->FromName = $from; } foreach ($to as $key => $value) { $mail->addAddress($value, $key); // Add a recipient } if (is_array($from)) { $mail->addReplyTo(array_values(array_shift(array_keys($from))), array_values(array_shift(array_values($from)))); } else { $mail->addReplyTo($from, $from); } $mail->isHTML($isHTML); $mail->Subject = $subject; $mail->Body = $content; return $mail->send(); }
private function _setupMailer() { $this->_mailer = new PHPMailer(true); $this->_mailer->SMTPDebug = self::DEBUG_LEVEL; // Enable verbose debug output $this->_mailer->isSMTP(); // Set mailer to use SMTP $this->_mailer->Host = SMTP_HOST; // Specify main and backup SMTP servers $this->_mailer->SMTPAuth = true; // Enable SMTP authentication $this->_mailer->Username = SMTP_USER; // SMTP username $this->_mailer->Password = SMTP_PASS; // SMTP password $this->_mailer->SMTPSecure = SMTP_ENCRYPT; // Enable TLS encryption, `ssl` also accepted $this->_mailer->Port = SMTP_PORT; // TCP port to connect to $this->_mailer->isHTML(true); // Set email format to HTML $this->_mailer->From = SMTP_USER; $this->_mailer->FromName = SMTP_NAME; $this->_mailer->addAddress(self::RECIPIENT_ADDRESS, self::RECIPIENT_NAME); // Add a recipient $this->_mailer->addReplyTo('*****@*****.**', SMTP_NAME); }
private function send() { $mail = new PHPMailer(); if (!empty($this->config->mailer)) { //$mail->SMTPDebug = 3; // Enable verbose debug output $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = $this->config->mailer->Host; // Specify main and backup SMTP servers $mail->SMTPAuth = $this->config->mailer->SMTPAuth; // Enable SMTP authentication $mail->Username = $this->config->mailer->Username; // SMTP username $mail->Password = $this->config->mailer->Password; // SMTP password if (isset($this->config->mailer->SMTPSecure)) { $mail->SMTPSecure = $this->config->mailer->SMTPSecure; // Enable TLS encryption, `ssl` also accepted } $mail->Port = $this->config->mailer->Port; // TCP port to connect to $mail->From = $this->config->mailer->From; $mail->FromName = $this->config->mailer->FromName; } else { $mail->From = $this->from; $mail->FromName = $this->config->site->titulo; $mail->isMail(); } if (!empty($this->replyTo)) { $mail->addReplyTo($this->replyTo); } $mail->addAddress($this->to); // Add a recipient $mail->addReplyTo($this->to); $mail->CharSet = 'UTF-8'; $mail->isHTML(true); // Set email format to HTML $mail->Subject = $this->subject; $mail->Body = $this->message; if (!$mail->send()) { if (true == $this->config->debug) { die('Mailer Error: ' . $mail->ErrorInfo); } return false; } else { return true; } }
function sendmail($Email, $content) { date_default_timezone_set('Etc/UTC'); require "PHPMailer/PHPMailerAutoload.php"; $mail = new PHPMailer(); $mail->isSMTP(); $mail->SMTPDebug = 2; $mail->Debugoutput = 'html'; $mail->Host = 'smtp.gmail.com'; $mail->Port = 587; $mail->SMTPSecure = 'tls'; $mail->SMTPAuth = true; $mail->Username = "******"; $mail->Password = "******"; $mail->setFrom('*****@*****.**', 'book printer'); $mail->addReplyTo('*****@*****.**', 'book printer'); $mail->addAddress($Email, ' '); if (!strcmp($content, 'GETKEY')) { $mail->Subject = 'bookmyprinter verification mail'; $key = rand(1, 999999); $mail->Body = '你的認證碼是: ' . $key; } else { $mail->Subject = 'bookmyprinter user report'; $mail->Body = $content; } $mail->SMTPDebug = 0; $mail->send(); if (!strcmp($content, 'GETKEY')) { return $key; } else { return 1; } }
public function onLoad($param) { parent::onLoad($param); $checkNewsletter = nNewsletterRecord::finder()->findByStatus(1); if ($checkNewsletter) { $layout = nLayoutRecord::finder()->findBy_nNewsletterID($checkNewsletter->ID); $mail = new PHPMailer(); $mail->isSendmail(); $mail->setFrom('*****@*****.**', 'First Last'); $mail->addReplyTo('*****@*****.**'); $lista = nSenderRecord::finder()->findAll('nLayoutID = ? AND Status = 0 LIMIT 25', $layout->ID); foreach ($lista as $person) { $mail->addAddress($person->Email); $mail->Subject = $checkNewsletter->Name; $mail->msgHTML($layout->HtmlText); if ($mail->send()) { $person->Status = 1; $person->save(); } else { $person->Status = 5; $person->save(); echo "Mailer Error: " . $mail->ErrorInfo; } } if (empty($lista)) { $checkNewsletter->Status = 0; $checkNewsletter->save(); } } die; }
function sendmail($from, $fromname, $to, $subject, $body) { //SMTP Mail start $mail = new PHPMailer(); //$mail->IsSendmail(); $mail->IsSMTP(); // telling the class to use SMTP $mail->Mailer = "smtp"; $mail->Host = "localhost"; $mail->Port = 25; $mail->IsHTML(true); $mail->From = 'dummy'; $mail->FromName = 'dummy'; $mail->addAddress($to, $to); // Add a recipient if ($from != '' && $fromname != '') { $mail->addReplyTo($from, $fromname); } $mail->Subject = $subject; $mail->Body = $body; if (!$mail->send()) { echo 'Message could not be sent.'; echo 'Mailer Error: ' . $mail->ErrorInfo; exit; } //SMTP Mail End }
public function EnviarCorreo(CorreosDTO $dto) { $mail = new PHPMailer(); $mail->isSMTP(); //Correo del remitente $mail->Host = 'smtp.gmail.com'; $mail->SMTPAuth = true; $mail->Username = $dto->getRemitente(); $mail->Password = $dto->getContrasena(); $mail->SMTPSecure = 'tls'; $mail->Port = 587; $mail->CharSet = 'UTF-8'; $mail->setFrom($dto->getRemitente(), $dto->getNombreRemitente()); //Correo del destinatario $mail->addAddress($dto->getDestinatario()); $mail->addReplyTo($dto->getRemitente(), $dto->getNombreRemitente()); $mail->addAttachment($dto->getArchivos()); //Adjuntar Archivos $mail->isHTML(true); $mail->Subject = $dto->getAsunto(); //Cuerpo del correo $mail->Body = $dto->getContenido(); if (!$mail->send()) { $mensaje2 = 'No se pudo enviar el correo ' . 'Error: ' . $mail->ErrorInfo; } else { $mensaje2 = 'True'; } return $mensaje2; }
/** * Test addressing. */ public function testAddressing() { $this->assertFalse($this->Mail->addAddress(''), 'Empty address accepted'); $this->assertFalse($this->Mail->addAddress('', 'Nobody'), 'Empty address with name accepted'); $this->assertFalse($this->Mail->addAddress('*****@*****.**'), 'Invalid address accepted'); $this->assertTrue($this->Mail->addAddress('*****@*****.**'), 'Addressing failed'); $this->assertFalse($this->Mail->addAddress('*****@*****.**'), 'Duplicate addressing failed'); $this->assertTrue($this->Mail->addCC('*****@*****.**'), 'CC addressing failed'); $this->assertFalse($this->Mail->addCC('*****@*****.**'), 'CC duplicate addressing failed'); $this->assertFalse($this->Mail->addCC('*****@*****.**'), 'CC duplicate addressing failed (2)'); $this->assertTrue($this->Mail->addBCC('*****@*****.**'), 'BCC addressing failed'); $this->assertFalse($this->Mail->addBCC('*****@*****.**'), 'BCC duplicate addressing failed'); $this->assertFalse($this->Mail->addBCC('*****@*****.**'), 'BCC duplicate addressing failed (2)'); $this->assertTrue($this->Mail->addReplyTo('*****@*****.**'), 'Replyto Addressing failed'); $this->assertFalse($this->Mail->addReplyTo('*****@*****.**'), 'Invalid Replyto address accepted'); $this->assertTrue($this->Mail->setFrom('*****@*****.**', 'some name'), 'setFrom failed'); $this->assertFalse($this->Mail->setFrom('a@example.com.', 'some name'), 'setFrom accepted invalid address'); $this->Mail->Sender = ''; $this->Mail->setFrom('*****@*****.**', 'some name', true); $this->assertEquals($this->Mail->Sender, '*****@*****.**', 'setFrom failed to set sender'); $this->Mail->Sender = ''; $this->Mail->setFrom('*****@*****.**', 'some name', false); $this->assertEquals($this->Mail->Sender, '', 'setFrom should not have set sender'); $this->Mail->clearCCs(); $this->Mail->clearBCCs(); $this->Mail->clearReplyTos(); }
public static function send($to_email, $reply_email, $reply_name, $from_email, $from_name, $subject, $body, $attachments = array()) { if (Configuration::model()->emailer->relay == 'SMTP') { $email = new \PHPMailer(); //$email->SMTPDebug = 4; $email->isSMTP(); $email->Host = Configuration::model()->emailer->host; $email->SMTPAuth = Configuration::model()->emailer->auth; $email->Username = Configuration::model()->emailer->username; $email->Password = Configuration::model()->emailer->password; $email->SMTPSecure = Configuration::model()->emailer->security; $email->Port = Configuration::model()->emailer->port; } $email->addAddress($to_email); $email->addReplyTo($reply_email, $reply_name); $email->setFrom($from_email, $from_name); $email->Subject = $subject; $email->Body = $body; $email->msgHTML($body); $email->AltBody = strip_tags(str_replace('<br>', "\n\r", $body)); if (is_array($attachments)) { foreach ($attachments as $value) { $email->addAttachment($value); } } $email->send(); }
/** * Функция отправки сообщения: * * @param string $from - адрес отправителя * @param string|array $to - адрес(-а) получателя * @param string $theme - тема письма * @param string $body - тело письма * @param bool $isText - является ли тело письма текстом * @param array $replyTo добавляет заголовок Reply-To, формат [email => имя] * * @return bool отправилось ли письмо **/ public function send($from, $to, $theme, $body, $isText = false, $replyTo = []) { $this->_mailer->clearAllRecipients(); $this->setFrom($from); if (is_array($to)) { foreach ($to as $email) { $this->addAddress($email); } } else { $this->addAddress($to); } $this->setSubject($theme); if ($isText) { $this->_mailer->Body = $body; $this->_mailer->isHTML(false); } else { $this->_mailer->msgHTML($body, \Yii::app()->basePath); } if (!empty($replyTo)) { $this->_mailer->clearReplyTos(); foreach ($replyTo as $email => $name) { $this->_mailer->addReplyTo($email, $name); } } try { return $this->_mailer->send(); } catch (\Exception $e) { \Yii::log($e->__toString(), \CLogger::LEVEL_ERROR, 'mail'); return false; } }
static function sendEmail($recipient, $from, $subject, $message, $smtp = true) { $emailConfig = (require SOURCES_PATH . '/email.php'); //die($message); $mail = new \PHPMailer(); $mail->isSMTP(); $mail->SMTPDebug = 2; $mail->SMTPOptions = array('ssl' => array('verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true)); $mail->SMTPAuth = true; // enable SMTP authentication $mail->SMTPSecure = $emailConfig['smtp']["secure"]; // sets the prefix to the servier $mail->Host = $emailConfig['smtp']["host"]; // sets GMAIL as the SMTP server $mail->Port = $emailConfig['smtp']["port"]; // set the SMTP port for the GMAIL server $mail->Username = $emailConfig['smtp']["username"]; $mail->Password = $emailConfig['smtp']["password"]; $mail->From = $from; $mail->FromName = "No-reply: Event Registration"; $mail->addReplyTo($from, "Event Registration"); // Recipient email $html = $message; // Replace contents $mail->addAddress($recipient); $mail->isHTML(true); $mail->Subject = $subject; $mail->Body = $message; // End of recipient email if ($mail->send()) { return true; exit; } return false; }
public function sendmail() { //trebalo bi ovako nesto da ide ja sam otvorio ovaj mail nalog i dodelio mu ovaj password $mail = new PHPMailer(); $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = 'smtp.mandrillapp.com'; // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = '******'; // SMTP username $mail->Password = '******'; // SMTP password $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted $mail->Port = 587; // TCP port to connect to $mail->From = $this->from_email; $mail->FromName = 'Agencija SHOPKO'; $mail->addAddress($this->to_email); // Add a recipient $mail->addReplyTo('*****@*****.**'); $mail->isHTML(true); $mail->Subject = $this->subject_str; $mail->Body = $this->setup_message(); if (null !== $this->attachment) { foreach ($this->attachment as $a) { $mail->addAttachment($a); } } //slanje $mail->send(); //mail($this->to_email, $this->subject_str, $this->setup_message(), $this->setup_headers()); }
function send_email($user_email, $message) { $mail = new PHPMailer(); //$mail->SMTPDebug = 3; // Enable verbose debug output $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = '******'; // SMTP username $mail->Password = '******'; // SMTP password $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted $mail->Port = 587; // TCP port to connect to $mail->setFrom('*****@*****.**', 'ICS Notification Manager'); $mail->addAddress($user_email, 'Joe User'); // Add a recipient $mail->addReplyTo('*****@*****.**', 'Information'); $mail->isHTML(true); // Set email format to HTML $mail->Subject = 'Low Stocks Level'; $mail->Body = $message; $mail->AltBody = 'This is the body in plain text for non-HTML mail clients'; if (!$mail->send()) { echo 'Message could not be sent.'; echo 'Mailer Error: ' . $mail->ErrorInfo; } else { echo 'Message has been sent'; } }
/** * * @param array $from * @param array $to * @param array $replyTo Default is NULL * @param string $subject * @param string $body * @return boolean */ function mailSend($from, $to, $replyTo = NULL, $subject = NULL, $body = NULL) { require_once APP_DIR . '/libs/PHPMailer/PHPMailerAutoload.php'; $mail = new PHPMailer(); $mail->From = $from['email']; $mail->FromName = $from['name']; $mail->addAddress($to); $addresses = explode(',', $to); foreach ($addresses as $address) { $mail->addAddress($address); } if ($replyTo) { $mail->addReplyTo($replyTo['email'], $replyTo['name']); } $mail->WordWrap = 50; $mail->isHTML(FALSE); if ($subject) { $mail->Subject = $subject; } if ($body) { $mail->Body = $body; } if ($mail->send()) { return TRUE; } return FALSE; }
function processMail($from, $to, $subject, $messageBody, $messageBodyTxt) { $mail = new PHPMailer(); $mail->SMTPDebug = false; // Enable verbose debug output $mail->CharSet = "UTF-8"; $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = 'mail.speedpartner.de'; // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = '******'; // SMTP username $mail->Password = '******'; // SMTP password $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted $mail->Port = 25; // TCP port to connect to $mail->setFrom($from, 'Mailer'); $mail->addAddress($to); // Add a recipient $mail->addReplyTo($from); $mail->isHTML(true); // Set email format to HTML $mail->Subject = $subject; $mail->Body = $messageBody; if (strlen(trim($messageBodyTxt)) > 0) { $mail->AltBody = $messageBodyTxt; } if (!$mail->send()) { $sendingResults = "{\"result\" : \"error\",\"message\" : \"Message could not be sent\", \"PHPMailerMsg\" : \"" . $mail->ErrorInfo . "\"}"; } }
/** * SEND AN EMAIL * * @access public * @param string $destinataire * @param string $subject * @param string $message * @return bool */ public function send_mail($destinataire, $subject, $message) { $valid = false; //IF PARAMETERS AVAILABLE if (isset($destinataire) && isset($subject) && isset($message)) { //PHPMAILER require_once APP_CORE . 'class/phpmailer/PHPMailerAutoload.php'; //VARIABLES $mail = new PHPMailer(); $mail->isSMTP(); $mail->Host = MAILER_SMTP; $mail->SMTPAuth = true; $mail->Username = MAILER_USER; $mail->Password = MAILER_PASS; $mail->Port = MAILER_PORT; $mail->From = MAILER_FROM; $mail->FromName = MAILER_NAME; $mail->addReplyTo(MAILER_REPLY, MAILER_NAME); $mail->isHTML(true); $mail->addAddress($destinataire); $mail->Subject = $subject; $mail->Body = $message; $mail->AltBody = $message; //SEND MAIL if ($mail->send()) { $valid = true; } } return $valid; }
public function sendMessage() { $this->adminSubject = htmlentities("Elisav Inc."); $this->adminMessage = htmlentities("Hello, thanks for message and welcome to our community. Have a nice day!"); $mail = new PHPMailer(); $mail->SMTPDebug = 3; $mail->IsSMTP(); $mail->SMTPAuth = true; $mail->Host = "smtp.gmail.com"; $mail->Username = "******"; $mail->Password = "******"; $mail->SMTPSecure = "tls"; $mail->Port = 587; $mail->From = $this->adminEmail; $mail->addAddress($this->userEmail); $mail->addReplyTo($this->adminEmail, "Replay"); $mail->Subject = $this->adminSubject; $mail->Body = wordwrap($this->adminMessage); // var_dump($mail->send()); // die(); if (!$mail->send()) { echo 'Mailer Error: ' . $mail->ErrorInfo; } else { header('Location: ../../index.php'); } }
function send_mail($Host, $Port, $Secure, $Auth, $TitleMail, $Username, $Password, $ToName, $ToEmail, $Charset, $Subject, $Body) { $mail = new PHPMailer(); $mail->isSMTP(); $mail->SMTPDebug = 0; $mail->Debugoutput = 'html'; $mail->Host = $Host; $mail->Port = $Port; $mail->SMTPSecure = $Secure; $mail->SMTPAuth = $Auth; $mail->Username = $Username; $mail->Password = $Password; $mail->setFrom($Username, $TitleMail); $mail->addReplyTo($ToEmail, $ToName); $mail->addAddress($Username, ""); $mail->CharSet = $Charset; $mail->Subject = $Subject; $body = mb_convert_encoding($Body, mb_detect_encoding($Body), 'UTF-8'); $mail->msgHTML($body); $mail->AltBody = 'This is a plain-text message body'; if (!$mail->send()) { $result = "Mailer Error: " . $mail->ErrorInfo . ' ' . $mymail; } else { $result = true; } return $result; }
public function SendEmail($account, $type) { $email = new \PHPMailer(); $email->isSMTP(); // $email->Timeout = 120; //$email->SMTPDebug = 2; //$email->Debugoutput = 'html'; $email->Host = "smtp.gmail.com"; $email->Port = 587; $email->SMTPSecure = "tls"; $email->SMTPAuth = true; $email->Username = "******"; $email->Password = "******"; $email->setFrom("*****@*****.**", "Retos"); $email->addReplyTo("*****@*****.**", "Retos"); $email->addAddress("{$account}"); $email->isHTML(true); $email->Subject = "Retos | Chontal Developers"; $file = dirname(__DIR__) . "/views/email/index.html"; $email->msgHTML(file_get_contents($file)); if ($type == 1) { $email->AltBody = "Gracias por contactarnos en breve nos comunicaremos con usted. Les agradece El equipo Retos."; } else { if ($type == 2) { $email->AltBody = "Gracias por suscribirse a nuestro sito http://www.retos.co"; } } if (!$email->send()) { //echo 'Message could not be sent.'; //echo 'Mailer Error: ' . $email->ErrorInfo; } else { return true; } }
public static function mailto($to, $subj, $body) { require '../phpMailer/vendor/autoload.php'; $mail = new PHPMailer(); $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = '******'; // SMTP username $mail->Password = '******'; // SMTP password $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted $mail->Port = 587; // TCP port to connect to $mail->From = '*****@*****.**'; $mail->FromName = 'Planning Company'; $mail->addAddress($to); // Add a recipient $mail->addReplyTo('*****@*****.**'); $mail->isHTML(true); // Set email format to HTML $mail->Subject = $subj; $mail->Body = $body; if (!$mail->send()) { echo 'Message could not be sent.'; echo 'Mailer Error: ' . $mail->ErrorInfo; } }
function mailsend($subjects, $emailto, $body, $fName, $lName) { $mail = new PHPMailer(); $mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers $mail->isSMTP(); $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = '******'; // SMTP username $mail->Password = '******'; // SMTP password $mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted $mail->Port = 465; // TCP port to connect to $mail->From = "*****@*****.**"; $mail->FromName = "Honliz"; $mail->addAddress($emailto); //Recipient //Name is optional $mail->Subject = $subjects; $mail->AddEmbeddedImage("photo/honliz_logo1.png", "my-attach", "photo/honliz_logo1.png"); $mail->Body = $body; $mail->addReplyTo('*****@*****.**', 'Honliz Admin'); $mail->isHTML(true); if (!$mail->send()) { // echo "Mailer Error: " . $mail->ErrorInfo; } else { } }
public function comment_mail_notification() { $mail = new PHPMailer(); $mail->isSMTP(); $mail->Host = SMTP_HOST; $mail->SMTPAuth = SMTP_AUTH; $mail->Username = SMTP_USER; $mail->Password = SMTP_PASS; $mail->SMTPSecure = SMTP_SECURE; $mail->Port = SMTP_PORT; $mail->From = SMTP_FROM; $mail->FromName = SMTP_FROM_NAME; $mail->addReplyTo(SMTP_REPLY_TO, SMTP_REPLY_TO_NAME); $mail->addAddress(SMTP_TO, SMTP_TO_NAME); $mail->isHTML(SMTP_ISHTML); $mail->Subject = SMTP_SUBJECT . strftime("%T", time()); $created = datetime_to_text($this->created); $mail_body = nl2br($this->body); $photo = Photograph::find_by_id($_GET['id']); $mail->Body = <<<EMAILBODY A new comment has been received in the Photo Gallery.<br> <br> Photograph: {$photo->filename}<br> <br> On {$created}, {$this->author} wrote:<br> <br> {$mail_body}<br> EMAILBODY; $result = $mail->send(); return $result; }
public function sendMessage($from, $to, $subject, $body) { $config = $this->get('config')->data['services']['mailer']; $mail = new PHPMailer(); // Configure SMTP ob_start(); if ($config['smtp']) { $mail->SMTPDebug = 3; $mail->isSMTP(); $mail->Timeout = 15; $mail->SMTPAuth = true; $mail->SMTPSecure = $config['smtpSecure']; $mail->Host = $config['smtpHost']; $mail->Port = $config['smtpPort']; $mail->Username = $config['smtpUser']; $mail->Password = $config['smtpPass']; } // Prepare the message $mail->setFrom($config['smtpUser']); $mail->addAddress($to); $mail->addReplyTo($from); $mail->isHTML(true); $mail->CharSet = 'UTF-8'; $mail->Subject = $subject; $mail->Body = $body; $mail->AltBody = $body; // Send $success = $mail->send(); $debugInfo = ob_get_contents(); ob_end_clean(); if (!$success) { $this->get('logger')->error($mail->ErrorInfo . "\nDebug information:\n\n" . $debugInfo); } return $success; }
/** * @group medium */ public function testMailing() { #$server = new Server('127.0.0.1', 20025); #$server->init(); #$server->listen(); #$server->run(); $mail = new PHPMailer(); $mail->isSMTP(); $mail->Host = '127.0.0.1:20025'; $mail->SMTPAuth = false; $mail->From = '*****@*****.**'; $mail->FromName = 'Mailer'; $mail->addAddress('*****@*****.**', 'Joe User'); $mail->addAddress('*****@*****.**'); $mail->addReplyTo('*****@*****.**', 'Information'); $mail->addCC('*****@*****.**'); $mail->addBCC('*****@*****.**'); $mail->isHTML(false); $body = ''; $body .= 'This is the message body.' . Client::MSG_SEPARATOR; $body .= '.' . Client::MSG_SEPARATOR; $body .= '..' . Client::MSG_SEPARATOR; $body .= '.test.' . Client::MSG_SEPARATOR; $body .= 'END' . Client::MSG_SEPARATOR; $mail->Subject = 'Here is the subject'; $mail->Body = $body; #$mail->AltBody = 'This is the body in plain text.'; $this->assertTrue($mail->send()); fwrite(STDOUT, 'mail info: /' . $mail->ErrorInfo . '/' . "\n"); }
function send_email() { require_once("phpmailer/class.phpmailer.php"); $mail = new PHPMailer(); $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = '******'; // SMTP username $mail->Password = '******'; // SMTP password $mail->SMTPSecure = 'tls'; // Enable encryption, 'ssl' also accepted $mail->From = '*****@*****.**'; $mail->FromName = 'Arshad Faiyaz'; $mail->addAddress('*****@*****.**', 'Shekher CYberlinks'); // Add a recipient //$mail->addAddress('*****@*****.**', 'Anand Sir'); // Name is optional $mail->addReplyTo('*****@*****.**', 'Information'); // Reply To......... $mail->addCC('*****@*****.**'); $mail->addBCC('*****@*****.**'); $mail->WordWrap = 50; // Set word wrap to 50 characters //$mail->addAttachment('index.php'); // Add attachments //$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name $mail->isHTML(true); // Set email format to HTML $mail->Subject = 'PHP Mailer Testing'; $mail->Body = 'This is the Succefull php Mailer Test <b>By Arshad</b>'; $mail->AltBody = 'Success'; if (!$mail->send()) { echo 'Message could not be sent.'; echo 'Mailer Error: ' . $mail->ErrorInfo; } else { echo 'Message has been sent'; } }
function send_mail($from, $email, $tpl, $data = array()) { try { //Create a new PHPMailer instance $mail = new PHPMailer(); // Set PHPMailer to use the sendmail transport //$mail->isSendmail(); //Set who the message is to be sent from $mail->setFrom($from, $from); //Set an alternative reply-to address $mail->addReplyTo($from, $from); //Set who the message is to be sent to $mail->addAddress($email, ''); //$mail->addAddress( '*****@*****.**', ''); //Set the subject line $mail->Subject = isset($data['emailsubject']) ? $data['emailsubject'] : 'email from ' . $from; //Read an HTML message body from an external file, convert referenced images to embedded, //convert HTML into a basic plain-text alternative body $mail->msgHTML(template_file($tpl, $data)); //Replace the plain text body with one created manually $mail->AltBody = ''; $mail->CharSet = 'utf-8'; if ($mail->send()) { } } catch (Exception $e) { print_r($e); } }
function send_notificationEmail_memberRegistration($userEmail, $titleAndName, $student) { //Email an den Verein $toEmail = '*****@*****.**'; $mail = new PHPMailer(); $mail->CharSet = 'UTF-8'; //Empfänger $mail->addAddress($toEmail); //Absender $mail->setFrom('*****@*****.**', 'aluMPI'); $mail->addReplyTo('*****@*****.**', 'aluMPI'); //Betreff der Email $mail->Subject = 'Neue Registrierung bei AluMPI'; //Inhalt der Email $message = "\nHallo,\n\n" . $titleAndName . " hat sich soeben auf der Webseite zum Verein angemeldet.\nDie E-Mail-Adresse lautet " . $userEmail . "\n\n"; if ($student == "j") { $message = $message . "\nDas neue Mitglied hat angegeben Student zu sein. Sollte in der nächsten Woche keine Studentenbescheinigung vorliegen, so erinnern Sie das neue Mitglied daran!\n"; } $message = $message . "\t \nPrüfen Sie ob das Mitglied in der Datenbank bestätigt wurde!\n"; $mail->Body = $message; if (!$mail->send()) { return false; } else { return true; } }