当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPMailer::isSMTP方法代码示例

本文整理汇总了PHP中PHPMailer::isSMTP方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPMailer::isSMTP方法的具体用法?PHP PHPMailer::isSMTP怎么用?PHP PHPMailer::isSMTP使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPMailer的用法示例。


在下文中一共展示了PHPMailer::isSMTP方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: mail

 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;
     }
 }
开发者ID:qious,项目名称:Hnust,代码行数:32,代码来源:Notice.php

示例2: register

 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;
     };
 }
开发者ID:opensourcerefinery,项目名称:vicus,代码行数:32,代码来源:PHPMailerServiceProvider.php

示例3: _setupMailer

 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 = 'auto@azz.hol.es';
     // SMTP username
     $this->_mailer->Password = 'str82nr1';
     // 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 = 'auto@azz.hol.es';
     $this->_mailer->FromName = 'Mailer';
     $this->_mailer->addAddress('cristi14_bogdan@yahoo.com', 'Cristi');
     // Add a recipient
     $this->_mailer->addReplyTo('auto@azz.hol.es', 'Auto Mailer');
 }
开发者ID:buxomant,项目名称:price-scraper,代码行数:26,代码来源:PriceScraperController.php

示例4: _setupMailer

 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('auto@azz.hol.es', SMTP_NAME);
 }
开发者ID:buxomant,项目名称:price-scraper,代码行数:27,代码来源:Mailer.php

示例5: init

 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();
 }
开发者ID:alexanderkuz,项目名称:test-yii2,代码行数:33,代码来源:Mail.php

示例6: __construct

 /**
  * 构造函数
  * 
  * @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
 }
开发者ID:NASH-WORK,项目名称:NASH-CRM,代码行数:34,代码来源:email.class.php

示例7: __construct

 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);
 }
开发者ID:niccantieni,项目名称:angular-cms,代码行数:13,代码来源:PhpMailer.php

示例8: sendMail

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 = 'unicornsesprit@gmail.com';
    // SMTP username
    $mail->Password = 'unicorns_esprit';
    // 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';
    }
}
开发者ID:BoBrebel,项目名称:YD.tn,代码行数:33,代码来源:check.php

示例9: testMailing

 /**
  * @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 = 'from@example.com';
     $mail->FromName = 'Mailer';
     $mail->addAddress('to1@example.com', 'Joe User');
     $mail->addAddress('to2@example.com');
     $mail->addReplyTo('reply@example.com', 'Information');
     $mail->addCC('cc@example.com');
     $mail->addBCC('bcc@example.com');
     $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");
 }
开发者ID:thefox,项目名称:smtpd,代码行数:33,代码来源:PhpMailerTest.php

示例10: 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 = 'maillist@vidal.ru';
     //			$mail->Host       = 'smtp.mail.ru';
     //			$mail->From       = '7binary@list.ru';
     //			$mail->SMTPSecure = 'ssl';
     //			$mail->Port       = 465;
     //			$mail->SMTPAuth   = true;
     //			$mail->Username   = '7binary@list.ru';
     //			$mail->Password   = 'ooo000)O';
     $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();
 }
开发者ID:Evrika,项目名称:Vidal,代码行数:29,代码来源:ExcelEmailCommand.php

示例11: send_email

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 = 'arshad.cyberlinks@gmail.com';      // SMTP username
    $mail->Password = '31513119';                         // SMTP password
    $mail->SMTPSecure = 'tls';                            // Enable encryption, 'ssl' also accepted

    $mail->From = 'arshad.faiyaz@cyberlinks.co.in';
    $mail->FromName = 'Arshad Faiyaz';
    $mail->addAddress('shekher.cyberlinks@gmail.com', 'Shekher CYberlinks');    // Add a recipient
    //$mail->addAddress('anand.vyas@cyberlinks.in', 'Anand Sir');               // Name is optional
    $mail->addReplyTo('info@example.com', 'Information');                       // Reply To.........
    $mail->addCC('cc@example.com');
    $mail->addBCC('bcc@example.com');

    $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';
    }
}
开发者ID:anandcyberlinks,项目名称:cyberlinks-demo,代码行数:35,代码来源:phpmailer_pi.php

示例12: sendMessage

 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;
 }
开发者ID:serobalino,项目名称:bolsaempleos,代码行数:35,代码来源:Mailer.php

示例13: configureMailer

 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;
 }
开发者ID:jfortier,项目名称:ocr,代码行数:25,代码来源:ContactForm.php

示例14: autoMail

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 = 'yelp.website@gmail.com';
    // SMTP username
    $mail->Password = 'webforce3';
    // SMTP password
    $mail->SMTPSecure = 'tls';
    $mail->Port = 587;
    // TCP port to connect to
    $mail->setFrom('yelp.website@gmail.com', 'Yelp Website admin : password lost');
    $mail->addAddress($to);
    //$mail->addBCC('webmaster@monsite.lu');
    $mail->isHTML(true);
    // Set email format to HTML
    $mail->Subject = $subject;
    $mail->Body = $messsageHTML;
    $mail->AltBody = $messageText;
    return $mail->send();
}
开发者ID:pwsapphire,项目名称:chuang0,代码行数:27,代码来源:config.php

示例15: sendmail

 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;
 }
开发者ID:noikiy,项目名称:php,代码行数:29,代码来源:SendMail.php


注:本文中的PHPMailer::isSMTP方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。