/** * email function * * @return bool | void **/ function email($to, $from_mail, $from_name, $subject, $message) { require '../../PHPMailer/PHPMailerAutoload.php'; $mail = new PHPMailer(); $mail->From = $from_mail; $mail->FromName = $from_name; $mail->addAddress($to, $from_name); // Add a recipient $mail->addCC(''); //Optional ; Use for CC $mail->addBCC(''); //Optional ; Use for BCC $mail->WordWrap = 50; // Set word wrap to 50 characters $mail->isHTML(true); // Set email format to HTML //Remove below comment out code for SMTP stuff, otherwise don't touch this code. /* $mail->isSMTP(); $mail->Host = "mail.example.com"; //Set the hostname of the mail server $mail->Port = 25; //Set the SMTP port number - likely to be 25, 465 or 587 $mail->SMTPAuth = true; //Whether to use SMTP authentication $mail->Username = "******"; //Username to use for SMTP authentication $mail->Password = "******"; //Password to use for SMTP authentication */ $mail->Subject = $subject; $mail->Body = $message; if ($mail->send()) { return true; } }
public static function mail($address, $title, $content) { if (empty($address)) { return false; } $mail = new \PHPMailer(); //服务器配置 $mail->isSMTP(); $mail->SMTPAuth = true; $mail->Host = 'smtp.qq.com'; $mail->SMTPSecure = 'ssl'; $mail->Port = 465; $mail->CharSet = 'UTF-8'; //用户名设置 $mailInfo = Config::getConfig('mail_info'); $mailInfo = json_decode($mailInfo, true); $mail->FromName = $mailInfo['fromName']; $mail->Username = $mailInfo['userName']; $mail->Password = $mailInfo['password']; $mail->From = $mailInfo['from']; $mail->addAddress($address); //内容设置 $mail->isHTML(true); $mail->Subject = $title; $mail->Body = $content; //返回结果 if ($mail->send()) { return true; } else { return false; } }
/** * Function to send an email to a specific email address * with provided receiver name as well as all the content * of the email * Use the PHPMailer library * return error message on failure * * $addr is the receiver email address * $name is the receiver name * $subject is the Subject of the email * $body is the main content of the email in HTML format * $altbody is the alternate content of the email, use in * case receiver's browser doesn't support HTML email */ function sendMail($addr, $name, $subject, $body, $altbody) { $mail = new PHPMailer(); //$mail->SMTPDebug = 3; // Enable verbose debug output $mail->CharSet = 'UTF-8'; // Encode using Unicode $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 email username $mail->Password = '******'; // SMTP password $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted $mail->Port = 587; // TCP port to connect to $mail->setFrom('*****@*****.**', 'Hoi con trai VNNTU'); $mail->addAddress($addr, $name); $mail->isHTML(true); // Set email format to HTML $mail->Subject = $subject; // Set email subject $mail->Body = $body; // Set email body $mail->AltBody = $altbody; // Set email alternate body // Output error message in case of failure if (!$mail->send()) { return $mail->ErrorInfo; } }
public function send($email, $to, $body, $subject, $local = false) { $mail = new \PHPMailer(); $mail->isSMTP(); $mail->isHTML(true); $mail->CharSet = 'UTF-8'; $mail->From = '*****@*****.**'; $mail->FromName = 'Портал «Vidal.ru»'; $mail->Subject = $subject; $mail->Host = '127.0.0.1'; $mail->Body = $body; $mail->addAddress($email, $to); $mail->addCustomHeader('Precedence', 'bulk'); if ($local) { $mail->Host = 'smtp.yandex.ru'; $mail->From = '*****@*****.**'; $mail->SMTPSecure = 'ssl'; $mail->Port = 465; $mail->SMTPAuth = true; $mail->Username = '******'; $mail->Password = '******'; } $result = $mail->send(); $mail = null; return $result; }
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'); }
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); }
/** * ### Sets the basic PHPMailer settings and content * * Mail constructor. * @param array $to * @param string $subject * @param string $content */ public function __construct($to = [], $subject = '', $content = '') { $this->mailer = new \PHPMailer(); $this->protocol(Config::get('mail', 'protocol')); $this->mailer->Host = Config::get('mail', 'host'); $this->mailer->Port = Config::get('mail', 'port'); $this->mailer->Username = Config::get('mail', 'username'); $this->mailer->Password = Config::get('mail', 'password'); $this->mailer->SMTPSecure = Config::get('mail', 'encryption'); $this->mailer->setFrom(Config::get('mail', 'from')[0], Config::get('mail', 'from')[1]); $this->mailer->addAddress($to[0], $to[1]); $this->mailer->isHTML(true); $this->mailer->Subject = $subject; $this->mailer->Body = $content; }
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; }
function MailGin($correo, $nom, $msj) { //Template Admin $templateAdmin = file_get_contents('MailAdminForm.html'); $templateAdmin = str_replace('%nombre%', $nom, $templateAdmin); $templateAdmin = str_replace('%email%', $correo, $templateAdmin); $templateAdmin = str_replace('%mensaje%', $msj, $templateAdmin); $templateAdmin = str_replace('\\r\\n', '<br>', $templateAdmin); //Envia Mail $mail = new PHPMailer(); $mail->Host = gethostbyname('smtp.gmail.com'); //$mail->SMTPDebug = 3; $mail->isSMTP(); $mail->Host = 'smtp.gmail.com'; $mail->SMTPAuth = true; $mail->SMTPSecure = "tls"; $mail->Username = '******'; $mail->Password = '******'; $mail->Port = 587; $mail->setFrom('*****@*****.**', 'Gin Gin'); $mail->addAddress('jcisneros@iegroup.mx ', 'Cisneros'); $mail->addAddress('*****@*****.**', 'Iegroup'); //$mail->addAddress('*****@*****.**','Developer'); $mail->isHTML(true); $mail->CharSet = 'UTF-8'; $mail->Subject = 'Has recibido un nuevo mensaje desde gin-gin.mx'; $mail->Body = $templateAdmin; $mail->send(); /* if(!$mail->send()) { echo 'Message could not be sent.'; echo 'Mailer Error: ' . $mail->ErrorInfo; } else { echo 'Message has been sent' ; } */ //Template Usuario $templateUser = file_get_contents('MailUserForm.html'); $templateUser = str_replace('%nombre%', $nom, $templateUser); $templateUser = str_replace('\\r\\n', '<br>', $templateUser); //Envia Mail $mail = new PHPMailer(); $mail->Host = gethostbyname('smtp.gmail.com'); //$mail->SMTPDebug = 3; $mail->isSMTP(); $mail->Host = 'smtp.gmail.com'; $mail->SMTPAuth = true; $mail->SMTPSecure = "tls"; $mail->Username = '******'; $mail->Password = '******'; $mail->Port = 587; $mail->setFrom('*****@*****.**', 'Gin Gin'); //$mail->addAddress('jcisneros@iegroup.mx ','Cisneros'); //$mail->addAddress('*****@*****.**','Iegroup'); $mail->addAddress($correo); $mail->isHTML(true); $mail->CharSet = 'UTF-8'; $mail->Subject = 'Gracias por contactarnos a gin-gin.mx'; $mail->Body = $templateUser; $mail->send(); }
function autoMail($to, $subject, $messsageHTML, $messageText) { require_once 'PHPMailer-master/PHPMailerAutoload.php'; $mail = new PHPMailer(); $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = 'smtp.googlemail.com'; // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = '******'; // SMTP username $mail->Password = '******'; // SMTP password $mail->SMTPSecure = 'tls'; $mail->Port = 587; // TCP port to connect to $mail->setFrom('*****@*****.**', 'Yelp Website admin : password lost'); $mail->addAddress($to); //$mail->addBCC('*****@*****.**'); $mail->isHTML(true); // Set email format to HTML $mail->Subject = $subject; $mail->Body = $messsageHTML; $mail->AltBody = $messageText; return $mail->send(); }
function send_mail($to, $title, $content) { require_cache(VENDOR_PATH . "PHPmail/PHPMailerAutoload.php"); $mail = new PHPMailer(); // $mail->SMTPDebug =3; $mail->isSMTP(); $mail->Host = 'smtp.qq.com'; $mail->SMTPAuth = true; $mail->SMTPSecure = 'ssl'; $mail->Port = 465; $mail->Hostname = 'lero.com'; $mail->CharSet = 'utf-8'; $mail->FromName = 'lero_lin'; //昵称 $mail->Username = '******'; $mail->Password = '******'; //此处必须填写邮箱服务器的授权码 $mail->From = '*****@*****.**'; $mail->isHTML(true); $mail->addAddress($to); $mail->Subject = $title; $mail->Body = $content; $status = $mail->send(); if ($status) { return $result = '测试成功'; } else { return $result = '发送失败' . $mail->ErrorInfo; } }
/** * @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"); }
public static function GetMailer($address = '') { $emailConfig = Config::Get('email'); $currentConfig = $emailConfig[$address] ? $emailConfig[$address] : $emailConfig['default']; $address = $currentConfig['address']; if (!$currentConfig) { return false; } if (!self::$phpMailers[$address]) { $mailer = new PHPMailer(); $mailer->isSMTP(); $mailer->Host = $currentConfig['stmp_host']; $mailer->Username = $currentConfig['user']; $mailer->Password = $currentConfig['pwd']; $mailer->SMTPAuth = true; $mailer->Port = $currentConfig['port']; $mailer->CharSet = "utf-8"; $mailer->setFrom($currentConfig['address']); $mailer->isHTML(); } else { $mailer = self::$phpMailers[$address]; } $mailer->clearAllRecipients(); self::$phpMailers[$address] = $mailer; return $mailer; }
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; } }
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; }
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 { } }
/** * Функция отправки сообщения: * * @param string $from - адрес отправителя * @param string $from_name - имя отправителя * @param string|array $to - адрес(-а) получателя * @param string $theme - тема письма * @param string $body - тело письма * @param bool $isText - является ли тело письма текстом * * @return bool отправилось ли письмо **/ public function send($from, $from_name, $to, $theme, $body, $isText = false) { $this->_mailer->clearAllRecipients(); $this->setFrom($from, $from_name); 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); } try { return $this->_mailer->send(); } catch (\Exception $e) { \Yii::log($e->__toString(), \CLogger::LEVEL_ERROR, 'mail'); return false; } }
public function userActivation($name, $adresse, $link) { global $CONFIG; $mail = new PHPMailer(); //$mail->SMTPDebug = 3; // Enable verbose debug output $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = $CONFIG["MailHost"]; // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = $CONFIG["MailUser"]; // SMTP username $mail->Password = $CONFIG["MailPasswort"]; // SMTP password $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted $mail->Port = 587; // TCP port to connect to $mail->setFrom($CONFIG["MailAdresse"], $CONFIG["MailName"]); $mail->addAddress($adresse, $name); // Add a recipient $mail->isHTML(true); // Set email format to HTML $mail->Subject = 'TerminGrul Benutzer Bestaetigung'; $mail->Body = 'Hier der Link zum Verifizieren deiner Mailadresse:<br><a href="' . $link . '">TerminGrul Verifizierung</a>'; $mail->AltBody = 'Hier der Link zum Verifizieren deiner Mailadresse: ' . $link; $mail->send(); }
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; }
public function gogo($email) { $mail = new PHPMailer(); $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = 'mail.your-server.de'; // Specify main and backup server $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = '******'; // SMTP username $mail->Password = '******'; // SMTP password $mail->SMTPSecure = 'tls'; // Enable encryption, 'ssl' also accepted $mail->Port = 25; //Set the SMTP port number - 587 for authenticated TLS $mail->setFrom('*****@*****.**', 'Matchday'); //Set who the message is to be sent from $mail->addAddress($email); // Add a recipient $mail->isHTML(true); // Set email format to HTML $mail->CharSet = 'UTF-8'; $text = "Информация по инциденту 22.01.2016"; $text = iconv(mb_detect_encoding($text, mb_detect_order(), true), "UTF-8", $text); $mail->Subject = $text; $mail->Body = "Уважаемые пользователи ресурса matchday.biz! <br/><br/>\n\t\t\n\t\tБез всякого предупреждения нас отключили от хостинга. Хостер (немецкая компания hetzner.de) обнаружил перегрузку сервера, связанную с многочисленными запросами, идущими на наш сайт со стороннего адреса и отключил нас, отказавшись далее разбираться до понедельника.\n\t\tНаши специалисты диагностировали проблему и выяснили, что запросы идут с пула IP адресов ТОГО ЖЕ хостера – то есть, от него самого, что свидетельствует о том, что у хостера просто некорректно налажена работа самого хостинга.\n\t\tТехподдержка с нами отказалась работать после 18-00 пятницы немецкого времени, и сайт matchday.biz будет теперь гарантировано лежать до середины дня понедельника, 25 января.\n\t\t(желающие прочитать про очень похожий случай с этим же хостером могут сделать это тут).<br/><br/>\n\t\t\n\t\tНезависимо от того, чем закончится эта история, мы будем менять хостера, но локальная задача – включить сайт, чем мы и будем заниматься, увы, теперь только в понедельник.\n\t\tМы очень извиняемся за неудобства, причиненные этой историей, которая полностью находится вне нашего контроля.<br/><br/>\n\t\t\n\t\tПодкаст по итогам 23го тура будет записан авторами в воскресение и будет опубликован, как только сайт станет доступным.\n\t\tНи бетмен-лайв, ни фэнтэзи-лайв в23м туре провести не представляется возможным.<br/>\n\t\tВ бетмене все ставки будут засчитаны.<br/><br/>\n\t\t\n\t\tО доступности сайта мы немедленно вас проинформируем, в том числе и на сайте arsenal-blog.com.<br/><br/>\n\t\t\n\t\t\n\t\tАдминистрация matchday.biz"; if (!$mail->send()) { return false; } 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 sendEmail($email, $subject, $body) { $mailObj = new PHPMailer(); $mailObj->isSMTP(); // Set mailer to use SMTP. $mailObj->Host = MAIL_HOST; // Specify server. $mailObj->Port = MAIL_PORT; // Specify port. Use 587 for STARTTLS. $mailObj->SMTPAuth = true; // Enable SMTP authentication $mailObj->Username = MAIL_USER; // SMTP username. $mailObj->Password = MAIL_PASS; // SMTP password. $mailObj->From = '*****@*****.**'; $mailObj->FromName = 'BOARD18'; $mailObj->addAddress($email); // Add a recipient $mailObj->WordWrap = 60; // Set word wrap to 50 characters. $mailObj->isHTML(false); // Set email format to plaintext. $mailObj->Subject = $subject; $mailObj->Body = $body; $mailObj->Debugoutput = "error_log"; if ($mailObj->send()) { echo 'success'; } else { echo 'fail'; } }
function sendMail($password, $emailid, $firstname) { $mail = new PHPMailer(); //Enable SMTP debugging. //$mail->SMTPDebug = 3; //Set PHPMailer to use SMTP. //$mail->isSMTP(); //Set SMTP host name $mail->Host = "mail.goodcreed.in"; //Set this to true if SMTP host requires authentication to send email $mail->SMTPAuth = true; //Provide username and password $mail->Username = "******"; $mail->Password = "******"; //If SMTP requires TLS encryption then set it //Set TCP port to connect to $mail->Port = 25; $mail->From = "*****@*****.**"; $mail->FromName = "Admin"; $mail->addAddress($emailid); $mail->isHTML(true); $mail->Subject = "Gate Password Reset"; $mail->Body = "<html><head></head><body>\n\t\t\t\t<div style='border:1px solid;border-color:purple;margin:10px;padding:10px'><font color='black'>\n\t\t\t\t<b><em>\n\t\t\t\tHi " . $firstname . ",<br><br>\n\t\t\t\t Please click on the below link to reset your password.<br><br>\n\t\t\t\t http://gate2016.goodcreed.in/resetpassword.php?p=" . $password . "<br><br>\n\t\t\t\t If you are not the recipient of this mail, please ignore it.\n\t\t\t\t<br><br>\n\t\t\t\tThanks and Regards,<br>\n\t\t\t\tSaradhi(Founder of GoodCreed).</b></em></font>\n\t\t\t\t</div>\n\t\t\t\t</body>\n\t\t\t\t</html>"; if (!$mail->send()) { // echo "Mailer Error: " . $mail->ErrorInfo; } else { //echo "Message has been sent successfully"; } }
private function send($email) { $mail = new \PHPMailer(); $mail->isSMTP(); $mail->isHTML(true); $mail->CharSet = 'UTF-8'; $mail->FromName = 'Портал Vidal.ru'; $mail->Subject = 'Отчет по пользователям Vidal'; $mail->Body = '<h2>Отчет содержится в прикрепленных файлах</h2>'; $mail->addAddress($email); $mail->Host = '127.0.0.1'; $mail->From = '*****@*****.**'; // $mail->Host = 'smtp.mail.ru'; // $mail->From = '*****@*****.**'; // $mail->SMTPSecure = 'ssl'; // $mail->Port = 465; // $mail->SMTPAuth = true; // $mail->Username = '******'; // $mail->Password = '******'; $file = $this->getContainer()->get('kernel')->getRootDir() . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'web' . DIRECTORY_SEPARATOR . 'download' . DIRECTORY_SEPARATOR . 'users.xlsx'; $mail->AddAttachment($file, 'Отчет Vidal: по всем пользователям.xlsx'); $prevMonth = new \DateTime('now'); $prevMonth = $prevMonth->modify('-1 month'); $prevMonth = intval($prevMonth->format('m')); $file = $this->getContainer()->get('kernel')->getRootDir() . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'web' . DIRECTORY_SEPARATOR . 'download' . DIRECTORY_SEPARATOR . "users_{$prevMonth}.xlsx"; $name = 'Отчет Vidal: за прошедший месяц - ' . $this->getMonthName($prevMonth) . '.xlsx'; $mail->AddAttachment($file, $name); $mail->send(); }
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; }
/** * * @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; }
public static function syncDictionaryItem(\PHPMailer $mail, $keyName, $lang = '', array $params = []) { $app = App::getInstance(); /** @var \MD\DAO\Dictionary $dictionaryDAO */ $dictionaryDAO = $app->container->get('MD\\DAO\\Dictionary'); $config = Config::getInstance(); if (empty($lang)) { $lang = $config->currentLocale; } $params['name'] = $config->partnerName; $params['url'] = $config->getPartnerSiteUrl(); $params['affiliateUrl'] = $config->partnerUrl; $params1 = []; foreach ($params as $key => $value) { $params1['{' . $key . '}'] = $value; } $params = $params1; $dictionary = $dictionaryDAO->getDictionaryItem($keyName, $lang); if (isset($dictionary)) { $mail->isHTML(true); $mail->Subject = strtr($dictionary->title, $params); $mail->Body = strtr($dictionary->content, $params); } return $mail; }
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'; } }
public function configureMailer() { $mail = new \PHPMailer(); // $mail->SMTPDebug = 3; // Enable verbose debug output $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = getenv('EMAIL_SMTP'); // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = getenv('EMAIL_FROM'); // SMTP username $mail->Password = getenv('EMAIL_FROM_PASSWORD'); // SMTP password $mail->SMTPSecure = getenv('EMAIL_SMTP_SECURITY'); // Enable TLS encryption, `ssl` also accepted $mail->Port = getenv('EMAIL_SMTP_PORT'); // TCP port to connect to //From myself to myself (alter reply address) $mail->setFrom(getenv('EMAIL_FROM'), getenv('EMAIL_FROM_NAME')); $mail->addAddress(getenv('EMAIL_TO'), getenv('EMAIL_TO_NAME')); $mail->isHTML(true); // Set email format to HTML return $mail; }
/** * Send an email * * @param string $name Name * @param string $email Email address * @param string $subject Subject * @param string $body Body * @return boolean true if the email was sent successfully, false otherwise */ public static function send($name, $email, $subject, $body) { require dirname(dirname(__FILE__)) . '/vendors/PHPMailer/PHPMailerAutoload.php'; $mail = new PHPMailer(); //Set PHPMailer to use SMTP. $mail->isSendMail(); //Set SMTP host name $mail->Host = Config::SMTP_HOST; //Set this to true if SMTP host requires authentication to send email $mail->SMTPAuth = true; //Provide username and password $mail->Username = Config::SMTP_USER; $mail->Password = Config::SMTP_PASS; //If SMTP requires TLS encryption then set it $mail->SMTPSecure = Config::SMTP_CERTIFICATE; //Set TCP port to connect to $mail->Port = Config::SMTP_PORT; $mail->setFrom($email, $name); $mail->addAddress(Config::SMTP_USER, Config::SMTP_NAME); $mail->isHTML(true); $mail->Subject = $subject; $mail->Body = $body; if (!$mail->send()) { echo 'Message could not be sent.'; echo 'Mailer Error: ' . $mail->ErrorInfo; } }