send() public method

Uses the sending method specified by $Mailer.
public send ( ) : boolean
return boolean false on error - See the ErrorInfo property for details of the error.
Beispiel #1
16
 /**
  * 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');
 }
        /**
         * Send email
         * @param 			array $to
         * @param 			array $from
         * @param 			string $subject
         * @param 			string $text
         * @param 			bool $use_template
         * @return 			bool
         */
        public function send($to, $from, $subject, $text, $use_template = true)
        {
            $this->client->setFrom($from[1], $from[0]);
            $this->client->addAddress($to[1], $to[0]);
            $this->client->Subject = $subject;
            if ($use_template) {
                $template = '
			<!DOCTYPE HTML>
			<html dir="rtl">
				<head>
					<meta charset="utf-8">
				</head>
				<body style="font-family: tahoma, sans-serif !important;">
					<div style="font: 13px tahoma,sans-serif !important;direction: rtl;background-color: #e8e8e8;">
						<div style="width: 70%;background-color: #fff;background-color: #fff; border-radius: 3px;margin: auto;position: relative;border-left: 1px solid #d9d9d9;border-right: 1px solid #d9d9d9;">
							<div style="top: 0;position: absolute;width: 100%; height: 4px;background: url( \'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAECAYAAAD8kH0gAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAGhJREFUeNpi/P///xkGKFh27TfDkiu/GQiBKC1WhhgdVoLqXkzsZHje30ZQnUR+OYNkYRVWORZkxy0DOo6JgGERpDhuYgcDAxN+EyVyS3E6DgSYkB3HQG3HEQo5Ao4DO3AwOw4EAAIMAMZJM9nl1EbWAAAAAElFTkSuQmCC\' ) repeat;"></div>
							<div style="padding: 22px 15px;">
								{TEXT}
							</div>
							<div style="bottom: 0;position: absolute;width: 100%; height: 4px;background: url( \'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAECAYAAAD8kH0gAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAGhJREFUeNpi/P///xkGKFh27TfDkiu/GQiBKC1WhhgdVoLqXkzsZHje30ZQnUR+OYNkYRVWORZkxy0DOo6JgGERpDhuYgcDAxN+EyVyS3E6DgSYkB3HQG3HEQo5Ao4DO3AwOw4EAAIMAMZJM9nl1EbWAAAAAElFTkSuQmCC\' ) repeat;"></div>
						</div>
					</div>
				</body>
			</html>
			';
                $msg = str_replace('{TEXT}', $text, $template);
            } else {
                $msg = $text;
            }
            $this->client->msgHTML($msg);
            return $this->client->send();
        }
Beispiel #3
1
 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;
     }
 }
Beispiel #4
1
/**
 * 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;
    }
}
Beispiel #5
0
 /**
  * Envia o email usando smtp como servico default
  * 
  * @return boolean
  * @throws Exception
  */
 public function send()
 {
     $this->chose_sender_strategy();
     $this->configure_smtp_parameters();
     try {
         return $this->php_mailer->send();
     } catch (phpmailerException $e) {
         throw new Exception($e->getMessage());
     }
 }
Beispiel #6
0
 public function sendLowPriceEmail($productName, $productUrl, $currentPrice, $previousPrice)
 {
     $title = "Price Alert - " . $productName;
     $msg = "Current price: " . $currentPrice . "<br/> Previous Price: " . $previousPrice;
     $msg .= '<br/><br/> Get it now at: <a href="' . $productUrl . '">' . $productUrl . '</a>';
     $this->_mailer->Subject = $title;
     $this->_mailer->Body = $msg;
     if (!$this->_mailer->send()) {
         echo 'Message could not be sent.';
         echo 'Mailer Error: ' . $this->_mailer->ErrorInfo;
     } else {
         echo 'Message has been sent';
     }
 }
Beispiel #7
0
 /**
  * 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;
     }
 }
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';
    }
}
Beispiel #9
0
 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>";
     }
 }
Beispiel #10
0
 /**
  * 
  * @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;
 }
Beispiel #11
0
 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();
 }
Beispiel #12
0
 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;
 }
Beispiel #13
0
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 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;
 }
Beispiel #15
0
 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;
 }
Beispiel #16
0
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';
    }
}
Beispiel #17
0
 /**
  * Функция отправки сообщения:
  *
  * @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;
     }
 }
Beispiel #18
0
    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;
    }
Beispiel #19
0
 /**
  * @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 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 {
    }
}
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;
    }
}
Beispiel #22
0
 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($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&nbsp;" . $firstname . ",<br><br>\n\t\t\t\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Please click on the below link to reset your password.<br><br>\n\t\t\t\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;http://gate2016.goodcreed.in/resetpassword.php?p=" . $password . "<br><br>\n\t\t\t\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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";
    }
}
Beispiel #24
0
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();
}
Beispiel #25
0
 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;
     }
 }
Beispiel #26
0
 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;
 }
Beispiel #27
0
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();
}
 /**
  * PDF of a test order is downloaded by this method
  */
 public function downloadpdfAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(true);
     $id = $this->getRequest()->getParam('id', '');
     $email = $this->getRequest()->getParam('email', 0);
     require_once 'mpdf/mpdf.php';
     $html .= $this->view->action('viewreport', 'patient', 'patient', array('id' => $id));
     $mpdf = new mPDF('+aCJK', 'A4', '', '', 15, 15, 15, 0, 0, 0);
     $mpdf->mirrorMargins = 0;
     $mpdf->setAutoBottomMargin = 'stretch';
     $mpdf->SetDisplayMode('fullwidth');
     $mpdf->WriteHTML($html);
     $fileName = 'PDF_Form' . time() . '.pdf';
     $mpdf->Output('tmp/' . $fileName, $email ? 'F' : 'D');
     if ($email) {
         $patient = patient::getOrderById($id);
         $mail = new PHPMailer();
         $mail->From = '*****@*****.**';
         $mail->FromName = 'Lab';
         $mail->addAddress($patient[0]['email'], '');
         $mail->addAttachment('tmp/' . $fileName);
         $mail->Subject = 'Your Test Report';
         $mail->Body = 'Please find attached report';
         if (!$mail->send()) {
             echo 'Message could not be sent.';
             echo 'Mailer Error: ' . $mail->ErrorInfo;
         } else {
             unlink('tmp/' . $fileName);
             $flashMessenger = $this->_helper->getHelper('FlashMessenger');
             $flashMessenger->addMessage('mail_sent');
             $this->_redirect('/patient/orders');
         }
     }
 }
 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");
         }
     }
 }
Beispiel #30
-2
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);
    }
}