/** * 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 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; } }
public function register(Container $container) { $container['mail'] = function ($c) { //Create a new PHPMailer instance $mail = new PHPMailer(); //Tell PHPMailer to use SMTP // if($c['phpmailer']['smtp']) $mail->isSMTP(); //Enable SMTP debugging // 0 = off (for production use) // 1 = client messages // 2 = client and server messages $mail->SMTPDebug = $c['phpmailer']['smtpdebug']; //Ask for HTML-friendly debug output $mail->Debugoutput = 'html'; //Set the hostname of the mail server $mail->Host = $c['phpmailer']['host']; //Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission $mail->Port = $c['phpmailer']['port']; //Set the encryption system to use - ssl (deprecated) or tls $mail->SMTPSecure = $c['phpmailer']['smtpsecure']; //Whether to use SMTP authentication $mail->SMTPAuth = $c['phpmailer']['smtpauth']; //Username to use for SMTP authentication - use full email address for gmail $mail->Username = $c['phpmailer']['username']; //Password to use for SMTP authentication $mail->Password = $c['phpmailer']['password']; //Set who the message is to be sent from // $mail->setFrom($c['phpmailer.mail'], $c['phpmailer.firm']); return $mail; }; }
/** * 构造函数 * * @access public * @param string $config['host'] SMTP 服务器 * @param string $config['username'] * @param string $config['password'] * @return void */ public function __construct($config) { if (file_exists('third_party/phpMailer/class.phpmailer.php') && file_exists('third_party/phpMailer/class.smtp.php')) { include 'third_party/phpMailer/class.phpmailer.php'; include 'third_party/phpMailer/class.smtp.php'; } else { throw new Exception('phpMailer lib not found.', 204); } $this->host = $config['host']; $this->userName = $config['username']; $this->password = $config['password']; $this->phpMailer = new PHPMailer(); $this->phpMailer->CharSet = $this->charSet; $this->phpMailer->isSMTP(); $this->phpMailer->SMTPDebug = $this->isDebug; $this->phpMailer->SMTPAuth = true; $this->phpMailer->Host = $this->host; $this->phpMailer->Port = $this->port; $this->phpMailer->Username = $this->userName; $this->phpMailer->Password = $this->password; $this->phpMailer->SetFrom(self::SENDFROMADDRESS, '纳米服务'); $this->phpMailer->Subject = '你有新的通知信息'; $this->phpMailer->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional, comment out and test }
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); }
public function init() { $this->_mailer = new \PHPMailer(); switch ($this->method) { case 'smtp': $this->_mailer->isSMTP(); $this->_mailer->Host = $this->smtp['host']; if (!empty($this->smtp['username'])) { $this->_mailer->SMTPAuth = true; $this->_mailer->Username = $this->smtp['username']; $this->_mailer->Password = $this->smtp['password']; } else { $this->_mailer->SMTPAuth = false; } if (isset($this->smtp['port'])) { $this->_mailer->Port = $this->smtp['port']; } if (isset($this->smtp['secure'])) { $this->_mailer->SMTPSecure = $this->smtp['secure']; } if (isset($this->smtp['debug'])) { $this->_mailer->SMTPDebug = (int) $this->smtp['debug']; } break; case 'sendmail': $this->_mailer->isSendmail(); break; default: $this->_mailer->isMail(); } $this->_mailer->CharSet = \Yii::app()->charset; parent::init(); }
public function __construct($host, $username, $password, $port) { $this->phpMailer = new \PHPMailer(true); // Set mailer to use SMTP $this->phpMailer->isSMTP(); $this->phpMailer->SMTPDebug = false; $this->phpMailer->Debugoutput = 'html'; // update settings $this->phpMailer->Host = $host; $this->phpMailer->Username = $username; $this->phpMailer->Password = $password; $this->phpMailer->Port = intval($port); }
function sendMail($name, $maill, $message) { $mail = new PHPMailer(); $msg = wordwrap($message, 70); $mail->Debugoutput = 'html'; // 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->From = $maill; $sujet = $name; $mail->addAddress($maill); // Name is optional $mail->Subject = $sujet; $mail->Body = $message; if (!$mail->send()) { echo 'Message could not be sent.'; echo 'Mailer Error: ' . $mail->ErrorInfo; } else { echo 'Message has been sent'; } }
function forgotPassword() { $targetEmail = $this->input->post('email'); $result = $this->users_model->emailVerif($targetEmail); $url = site_url('/index/view'); if ($result == "Invalid") { echo "<script>alert('Invalid email address.')</script>"; echo "<script> window.location = '{$url}'</script>"; } else { $path = APPPATH; echo "<script>alert('{$path}')</script>"; require_once APPPATH . '\\third_party\\mailer\\PHPMailerAutoload.php'; $m = new PHPMailer(); $m->isSMTP(); $m->SMTPAuth = true; //$m->SMTPDebug = 2; $m->Host = "smtp.gmail.com"; $m->Username = "******"; $m->Password = "******"; $m->SMTPSecure = "ssl"; $m->Port = 465; $m->From = "*****@*****.**"; $m->FromName = "UMT"; $m->addAddress($targetEmail, ""); //$m->$addCC("*****@*****.**", "UMT"); //$m->addBCC("*****@*****.**", "UMT"); $m->Subject = "Password Recovery"; $m->Body = "Here is your password: '******'. We recommend that you change it after logging-in."; $m->send(); echo "<script>javascript:alert('Sent successfully')</script>"; echo "<script> window.location = '{$url}'</script>"; } }
/** * @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 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(); }
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; }
public function actionSendEmail() { $mail = new \PHPMailer(); //будем отравлять письмо через СМТП сервер $mail->isSMTP(); //хост $mail->Host = 'smtp.yandex.ru'; //требует ли СМТП сервер авторизацию/идентификацию $mail->SMTPAuth = true; // логин от вашей почты $mail->Username = '******'; // пароль от почтового ящика $mail->Password = '******'; //указываем способ шифромания сервера $mail->SMTPSecure = 'ssl'; //указываем порт СМТП сервера $mail->Port = '465'; //указываем кодировку для письма $mail->CharSet = 'UTF-8'; //информация от кого отправлено письмо $mail->From = '*****@*****.**'; $mail->FromName = 'Админ'; $mail->addAddress($_POST['mail']); $mail->isHTML(true); $mail->Subject = $_POST['title']; $mail->Body = $_POST['text']; if ($mail->send()) { echo 'Письмо отправлено'; } else { echo 'Письмо не может быть отправлено. '; echo 'Ошибка: ' . $mail->ErrorInfo; } }
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; } }
function send_mail($msg_content, $s_email, $s_name) { require '/home/paulme9/public_html/includes/PHPMailer/PHPMailerAutoload.php'; $mail = new PHPMailer(); $mail->isSMTP(); $mail->Host = 'secure150.inmotionhosting.com'; $mail->SMTPAuth = true; $mail->Username = '******'; $mail->Password = '******'; $mail->SMTPSecure = "ssl"; $mail->Port = 465; $mail->SMTPDebug = 0; //0=none, 1=commands, 2=commands+data $mail->Debugoutput = 'html'; $mail->From = '*****@*****.**'; $mail->FromName = $s_name; $mail->Sender = $s_email; $mail->ReturnPath = '*****@*****.**'; $mail->addAddress($s_email, $s_name); $mail->WordWrap = 60; $mail->Subject = 'Registration for paul-merideth.com'; $mail->Body = $msg_content; if (!$mail->send()) { return FALSE; } else { return TRUE; } }
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; }
protected function setup_phpmailer() { $mail = new \PHPMailer(); $mail->isSMTP(); // Configure SMTP Server $mail->Host = $this->smtp_config->host; $mail->SMTPAuth = $this->smtp_config->auth; $mail->Port = $this->smtp_config->port; $mail->setFrom($this->smtp_config->send_email, 'Server Monitor'); // Optional SMTP settings if (isset($this->smtp_config->secure)) { $email->SMTPSecure = $this->smtp_config->secure; } if (isset($this->smtp_config->auth)) { $mail->Username = $this->smtp_config->username; $mail->Password = $this->smtp_config->password; } // Add subject $mail->Subject = $this->email_subject; // Add text $mail->Body = $this->email_text; // Add recipients $mail = $this->add_email_addresses($mail, $this->email_addresses); return $mail; }
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 static function sendEmail($emails, $title, $text, $isHtml = true) { $mail = new PHPMailer(); $mail->isSMTP(); $mail->SMTPAuth = true; $mail->Host = SMTPHost; $mail->Username = SMTPUser; $mail->Password = SMTPPass; $mail->From = MailFrom; $mail->FromName = MailFromName; $mail->CharSet = "UTF-8"; $mail->IsHTML($isHtml); if (is_array($emails)) { foreach ($emails as $email) { $mail->addAddress($email); } } else { $mail->addAddress($emails); } $mail->Subject = $title; $mail->Body = $text; if (!$mail->send()) { Util::SmallLog('mail', $mail->ErrorInfo); return false; } else { return true; } }
function email($users, $subject, $body, $altbody) { global $CONFIG; global $PAGES; require_once $PAGES['autoload']; $mail = new PHPMailer(); // $mail->SMTPDebug = 3; $mail->isSMTP(); $mail->Host = "smtp.gmail.com"; $mail->SMTPAuth = true; $mail->Username = $CONFIG['mailer']['email']; $mail->Password = $CONFIG['mailer']['password']; $mail->SMTPSecure = 'tls'; $mail->Port = 587; $mail->setFrom($CONFIG['mailer']['email'], 'Maid'); foreach ($users as $user) { $mail->addAddress($user->email, $user->name); } $mail->isHTML(true); $mail->Subject = $subject; $mail->Body = $body; $mail->AltBody = $altbody; if (!$mail->send()) { echo 'Message could not be sent.'; echo 'Mailer Error: ' . $mail->ErrorInfo; return false; } return true; }
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 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 static function sendmail($toList, $subject, $content) { $mail = new \PHPMailer(); $mail->isSMTP(); $mail->Host = self::SMTP_HOST; $mail->SMTPAuth = true; $mail->Username = self::SMTP_USER; $mail->Password = self::SMTP_PASSWD; $mail->SMTPSecure = self::SMTP_SECURE; $mail->Port = self::SMTP_PORT; $mail->Timeout = 3; // seconds $mail->From = self::MAIL_FROM; $mail->CharSet = 'utf-8'; $mail->FromName = 'xxx'; // TODO foreach ($toList as $to) { $mail->addAddress($to); } //$mail->isHTML(true); $mail->Subject = $subject; $mail->Body = $content; $mail->AltBody = $content; if (!$mail->send()) { Log::fatal('mailer error: ' . $mail->ErrorInfo); return false; } return true; }
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(); }
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 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 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(); }
function sendmail($to, $name, $subj, $msg) { $mail = new PHPMailer(); $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = getenv('MAIL_HOST'); // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = getenv('MAIL_USER'); // SMTP username $mail->Password = getenv('MAIL_PASS'); // SMTP password $mail->SMTPSecure = getenv('MAIL_DRIVER'); // Enable TLS encryption, `ssl` also accepted $mail->Port = getenv('MAIL_PORT'); // TCP port to connect to $mail->setFrom(getenv('MAIL_USER'), getenv('MAIL_NAME')); $mail->addAddress($to, $name); // Add a recipient $mail->isHTML(true); // Set email format to HTML $mail->Subject = $subj; $mail->Body = $msg; if (!$mail->send()) { echo 'Message could not be sent.'; echo 'Mailer Error: ' . $mail->ErrorInfo; } else { return true; } }
public function restaurarcuenta() { View::template('sbadmin'); if (Input::hasPost('correo')) { $Usuario = new Usuario(); $direccion = $_POST['correo']['email']; if ("SELECT count(*) FROM usuario WHERE email = '{$direccion}'" == 1) { $mail = new PHPMailer(); $mail->isSMTP(); //$mail>SMTPDebug = 2; $mail->SMTPAuth = true; $mail->SMTPSecure = "ssl"; $mail->Host = "smtp.gmail.com"; $mail->Port = 465; $mail->Username = "******"; $mail->Password = "******"; $mail->setFrom('*****@*****.**', 'Gestión Documental'); //$mail>AddReplyTo("*****@*****.**", "Steven Ruiz"); $mail->Subject = "asunto"; $mail->msgHTML("mensaje"); //$address = "*****@*****.**"; $mail->addAddress($_POST['correo']['email'], "..."); if (!$mail->send()) { echo "Error al enviar: " . $mail->ErrorInfo; } Input::delete(); } else { print_r("No hay cuenta asociada al correo digitado"); } } }