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


PHP PHPMailer::SmtpClose方法代码示例

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


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

示例1: sendEmail

function sendEmail($destinatario, $mittente, $obj, $msg)
{
    $sended = false;
    $mailer = new PHPMailer(true);
    $mailer->IsSMTP();
    $mailer->SMTPAuth = true;
    $mailer->Host = HOST;
    // Server SMTP
    $mailer->Port = PORT;
    // Porta SMTP
    $mailer->Username = USER;
    // SMTP account username
    $mailer->Password = PASS;
    // SMTP account password
    try {
        $mailer->AddAddress($destinatario, "<{$destinatario}>");
        $mailer->SetFrom($mittente, "Ceramiche Sofia - <{$mittente}>");
        $mailer->Subject = $obj;
        $mailer->MsgHTML($msg);
        $sended = $mailer->Send();
    } catch (phpmailerException $e) {
        $e->errorMessage();
    } catch (Exception $e) {
        $e->getMessage();
    }
    //Logout SMTP
    $mailer->SmtpClose();
    unset($mailer);
    return $sended;
}
开发者ID:gambric,项目名称:ceramichesofia,代码行数:30,代码来源:send-email.inc.php

示例2: sendMail

 public static function sendMail($paramEmailDestinatario, $paramNomeDestinatario, $paramOggetto, $paramTestoMail)
 {
     // Setto i parametri
     $mail = new PHPMailer();
     $mail->IsSMTP();
     $mail->Host = "smtp.gmail.com";
     $mail->SMTPSecure = "ssl";
     $mail->Port = 465;
     $mail->SMTPAuth = true;
     $mail->Username = "mattiadiluca@gmail.com";
     $mail->Password = 'matt89ii';
     // intestazione
     $mail->From = 'info@CarSharing.it';
     $mail->AddAddress($paramEmailDestinatario);
     $mail->AddReplyTo('mattiadiluca@gmail.com');
     $mail->Subject = $paramOggetto;
     $mail->Body = $paramTestoMail;
     // gestisco l'invio
     if (!$mail->Send()) {
         echo $mail->ErrorInfo;
     } else {
         echo 'email inviati correttamente';
     }
     // chiudo la connessione
     $mail->SmtpClose();
     unset($mail);
 }
开发者ID:mattia1989,项目名称:CarSharing,代码行数:27,代码来源:UEmail.php

示例3: send

 /**
  * Short description of method send
  *
  * @access public
  * @author Bertrand Chevrier, <bertrand.chevrier@tudor.lu>
  * @return int
  */
 public function send()
 {
     $returnValue = (int) 0;
     foreach ($this->messages as $message) {
         if ($message instanceof tao_helpers_transfert_Message) {
             $this->mailer->SetFrom($message->getFrom());
             $this->mailer->AddReplyTo($message->getFrom());
             $this->mailer->Subject = $message->getTitle();
             $this->mailer->AltBody = strip_tags(preg_replace("/<br.*>/i", "\n", $message->getBody()));
             $this->mailer->MsgHTML($message->getBody());
             $this->mailer->AddAddress($message->getTo());
             try {
                 if ($this->mailer->Send()) {
                     $message->setStatus(tao_helpers_transfert_Message::STATUS_SENT);
                     $returnValue++;
                 }
                 if ($this->mailer->IsError()) {
                     if (DEBUG_MODE) {
                         echo $this->mailer->ErrorInfo . "<br>";
                     }
                     $message->setStatus(tao_helpers_transfert_Message::STATUS_ERROR);
                 }
             } catch (phpmailerException $pe) {
                 if (DEBUG_MODE) {
                     print $pe;
                 }
             }
         }
         $this->mailer->ClearReplyTos();
         $this->mailer->ClearAllRecipients();
     }
     $this->mailer->SmtpClose();
     return (int) $returnValue;
 }
开发者ID:swapnilaptara,项目名称:tao-aptara-assess,代码行数:41,代码来源:MailAdapter.php

示例4: sendgmail

function sendgmail($addr, $body)
{
    $config = parse_ini_file('../../catchit/email_config.ini');
    require_once "phpmailer/class.phpmailer.php";
    include "phpmailer/class.smtp.php";
    $mail = new PHPMailer();
    $mail->IsSMTP();
    $mail->SMTPDebug = 0;
    $mail->SMTPAuth = true;
    $mail->SMTPSecure = "tls";
    $mail->Host = "smtp.gmail.com";
    $mail->Port = 587;
    $mail->Username = $config['address'];
    $mail->Password = $config['password'];
    $mail->Priority = 3;
    $mail->CharSet = 'UTF-8';
    $mail->Encoding = '8bit';
    $mail->Subject = 'Data from Catchit';
    $mail->ContentType = 'text/html; charset=utf-8\\r\\n';
    $mail->From = $config['address'];
    $mail->FromName = 'Catchit';
    $mail->WordWrap = 900;
    $mail->AddAddress($addr);
    $mail->isHTML(FALSE);
    $mail->Body = $body;
    $mail->Send();
    $mail->SmtpClose();
    if ($mail->IsError()) {
        return 'failed to send';
    } else {
        return 'Email has been sent';
    }
}
开发者ID:sivamkrish,项目名称:acceleration,代码行数:33,代码来源:mailer.php

示例5: sendMail

function sendMail()
{
    $cfg = new ini();
    $cfg->setFileName('./include/config/account.ini');
    $cfg->load();
    $user_mail = $cfg->getElementByValue('user', 'email');
    $mail = new PHPMailer();
    $mail->IsSMTP();
    //$mail->SMTPDebug= 2;
    //konfiguracja serwera
    $mail->PluginDir = "phpmailer/";
    $mail->Mailer = "smtp";
    $mail->Host = $cfg->getElementByValue('server-config', 'Host');
    $mail->SMTPSecure = $cfg->getElementByValue('server-config', 'SMTPSecure');
    $mail->Port = $cfg->getElementByValue('server-config', 'Port');
    //
    $mail->SMTPKeepAlive = true;
    $mail->SMTPAuth = true;
    $mail->Username = $cfg->getElementByValue('server-config', 'Login');
    $mail->Password = $cfg->getElementByValue('server-config', 'Passwort');
    //koniec połączenia
    //baza danych
    $mydb = new DB();
    $qwery = "SELECT `id`, `email` FROM mail_data Where sended=" . $checkbox_value;
    $request = mysql_query($qwery);
    if ($request === false) {
        die('Nie można było odebrać danych do bazy' . ' z powodu blendu:' . mysql_error());
    }
    if (mysql_num_rows() == 0) {
        echo 'Brak danych w bazie';
        exit(1);
    }
    while ($row = mysql_fetch_assoc($request)) {
        $id = $row['id'];
        $address = $row['email'];
        $mail->SetLanguage("pl", "phpmailer/language/");
        $mail->CharSet = "UTF-8";
        $mail->ContentType = "text/html";
        $mail->isHTML(true);
        $mail->From = user_mail;
        $mail->FromName = "Kamil z webbooster";
        $mail->Subject = "Tytuł wiadomości";
        $mail->Body = '
To jest nowa testowa treść, z prawidłowo interpretowanymi polskimi znaczkami, a to jest <b>pogrubione</b>, a to jest <a href="http://www.example.com">link</a><br/>
<div>trolololo</div>
';
        $mail->AddAddress($address);
        if ($mail->Send()) {
            return true;
        } else {
            throw new Exception('"E-mail nie mógł zostać wysłany, przyczyna :".$mail->ErrorInfo', 5);
        }
    }
    //
    $mail->SmtpClose();
    //zamykamy połączeie
}
开发者ID:kamz8,项目名称:mailbot,代码行数:57,代码来源:sendmail.php

示例6:

 /**
  * Test keepalive (sending multiple messages in a single connection)
  */
 function test_SmtpKeepAlive()
 {
     $this->Mail->Body = "This was done using the SMTP keep-alive.";
     $this->BuildBody();
     $subject = $this->Mail->Subject;
     $this->Mail->SMTPKeepAlive = true;
     $this->Mail->Subject = $subject . ": SMTP keep-alive 1";
     $this->assertTrue($this->Mail->Send(), $this->Mail->ErrorInfo);
     $this->Mail->Subject = $subject . ": SMTP keep-alive 2";
     $this->assertTrue($this->Mail->Send(), $this->Mail->ErrorInfo);
     $this->Mail->SmtpClose();
 }
开发者ID:NurulRizal,项目名称:BB,代码行数:15,代码来源:phpmailerTest.php

示例7: send

 public static function send($para_correo, $para_nombre, $asunto, $cuerpo, $de_correo = null, $de_nombre = null)
 {
     $mail = new PHPMailer();
     $mail->charSet = "UTF-8";
     $mail->IsSMTP();
     $mail->SMTPAuth = true;
     $mail->SMTPSecure = 'ssl';
     $mail->Host = Config::get('config.correo.host');
     $mail->Port = Config::get('config.correo.port');
     $mail->Username = Config::get('config.correo.username');
     $mail->Password = Config::get('config.correo.password');
     if ($de_correo != null && $de_nombre != null) {
         $mail->AddReplyTo($de_correo, $de_nombre);
         $mail->From = $de_correo;
         $mail->FromName = $de_nombre;
     } else {
         $mail->AddReplyTo(Config::get('config.correo.from_mail'), Config::get('config.correo.from_name'));
         $mail->From = Config::get('config.correo.from_mail');
         $mail->FromName = Config::get('config.correo.from_name');
     }
     $asunto = "=?utf-8?b?" . base64_encode($asunto) . "?=";
     $mail->Subject = $asunto;
     $mail->Body = $cuerpo;
     $mail->WordWrap = 50;
     $mail->MsgHTML($cuerpo);
     $emails = explode(';', $para_correo);
     if (count($emails) > 1) {
         foreach ($emails as $key => $value) {
             $mail->AddAddress(trim($value), trim($value));
         }
     } else {
         $mail->AddAddress(trim($para_correo), trim($para_correo));
     }
     $mail->AddAddress(Config::get('config.correo.from_mail'), Config::get('config.correo.from_name'));
     $mail->IsHTML(true);
     //Enviamos el correo
     $exito = $mail->Send();
     $intentos = 2;
     //esto se realizara siempre y cuando la variable $exito contenga como valor false
     while (!$exito && $intentos < 1) {
         sleep(2);
         $exito = $mail->Send();
         $intentos = $intentos + 1;
     }
     $mail->SmtpClose();
     return $exito;
 }
开发者ID:arleincho,项目名称:bee,代码行数:47,代码来源:mail.php

示例8: SendMail

function SendMail($ToEmail, $subject, $MessageHTML)
{
    require_once 'class.phpmailer.php';
    // Add the path as appropriate
    $Mail = new PHPMailer();
    $Mail->IsSMTP();
    // Use SMTP
    $Mail->Host = "smtp.gmail.com";
    // Sets SMTP server
    $Mail->SMTPDebug = 2;
    // 2 to enable SMTP debug information
    $Mail->SMTPAuth = TRUE;
    // enable SMTP authentication
    $Mail->SMTPSecure = "tls";
    //Secure conection
    $Mail->Port = 587;
    // set the SMTP port
    $Mail->Username = 'jitendra291192@gmail.com';
    // SMTP account username
    $Mail->Password = '222@jkc999@jkc';
    // SMTP account password
    $Mail->Priority = 1;
    // Highest priority - Email priority (1 = High, 3 = Normal, 5 = low)
    $Mail->CharSet = 'UTF-8';
    $Mail->Encoding = '8bit';
    $Mail->Subject = $subject;
    $Mail->ContentType = 'text/html; charset=utf-8\\r\\n';
    $Mail->From = 'jitendrachaudhary@iitj.ac.in';
    $Mail->FromName = 'Jitendra Chaudhary';
    $Mail->WordWrap = 900;
    // RFC 2822 Compliant for Max 998 characters per line
    $Mail->AddAddress($ToEmail);
    // To:
    $Mail->isHTML(TRUE);
    $Mail->Body = $MessageHTML;
    //$Mail->AltBody = $MessageTEXT;
    $Mail->Send();
    $Mail->SmtpClose();
    if ($Mail->IsError()) {
        // ADDED - This error checking was missing
        return FALSE;
        echo "check your email address";
    } else {
        return TRUE;
    }
}
开发者ID:rohitvineet,项目名称:PHP-Online-Shop,代码行数:46,代码来源:mailsend.php

示例9: SendMail

function SendMail($ToEmail, $Subject, $MessageHTML, $MessageTEXT)
{
    require ROOT . 'resources/phpmailer/PHPMailerAutoload.php';
    // Add the path as appropriate
    $Mail = new PHPMailer();
    $Mail->IsSMTP();
    // Use SMTP
    $Mail->Host = "smtpauth.bluewin.ch";
    // Sets SMTP server
    $Mail->SMTPDebug = 2;
    // 2 to enable SMTP debug information
    $Mail->SMTPAuth = TRUE;
    // enable SMTP authentication
    //   $Mail->SMTPSecure  = "tls"; // Secure conection
    $Mail->Port = 587;
    // set the SMTP port
    $Mail->Username = 'xampp@bluewin.ch';
    // SMTP account username
    $Mail->Password = 'prophEcy88';
    // SMTP account password
    $Mail->Priority = 1;
    // Highest priority - Email priority (1 = High, 3 = Normal, 5 = low)
    $Mail->CharSet = 'UTF-8';
    $Mail->Encoding = '8bit';
    $Mail->Subject = $Subject;
    $Mail->ContentType = 'text/html; charset=utf-8\\r\\n';
    $Mail->From = 'xampp@bluewin.ch';
    $Mail->FromName = 'The Breakfast Company - XAMPP';
    $Mail->WordWrap = 900;
    // RFC 2822 Compliant for Max 998 characters per line
    $Mail->AddAddress($ToEmail);
    // To:
    $Mail->addCC("webp@nellen.it");
    $Mail->isHTML(TRUE);
    $Mail->Body = $MessageHTML;
    $Mail->AltBody = $MessageTEXT;
    $Mail->Send();
    $Mail->SmtpClose();
    if ($Mail->IsError()) {
        // ADDED - This error checking was missing
        return FALSE;
    } else {
        return TRUE;
    }
}
开发者ID:nellen,项目名称:ch.bfh.bti7054.w2014.q.Web-Prophecies,代码行数:45,代码来源:mail.php

示例10: send

 function send($to, $subject, $content, $sender)
 {
     //echo 'sendmail!!';
     require_once ROOT . DS . 'library' . DS . 'class.phpmailer.php';
     $mail = new PHPMailer();
     $mail->CharSet = "UTF-8";
     $mail->SetLanguage('vi', ROOT . DS . 'library' . '/phpmailer/language/');
     $mail->IsSMTP();
     $mail->SMTPAuth = true;
     // enable SMTP authentication
     $mail->SMTPSecure = "ssl";
     // sets the prefix to the servier
     //$mail->Host       = "smtp.gmail.com";      // sets GMAIL as the SMTP server
     //$mail->Port       = 465;                   // set the SMTP port for the GMAIL server
     $mail->Host = $sender['smtp'];
     $mail->Port = $sender['port'];
     $mail->Username = $sender['email'];
     // GMAIL username
     $mail->Password = $sender['password'];
     // GMAIL password
     $from = $sender['email'];
     $mail->AddReplyTo('sale@jobbid.vn', "Jobbid.vn Support");
     $mail->From = $from;
     $mail->FromName = "Jobbid.vn Support";
     $mail->Sender = $from;
     $mail->Subject = $subject;
     //$mail->AltBody    = "Xin chao"; // optional, comment out and test
     //$mail->WordWrap   = 50; // set word wrap
     $mail->MsgHTML($content);
     if (is_array($to)) {
         foreach ($to as $email) {
             $mail->addBCC($email);
         }
     } else {
         $mail->AddAddress($to);
     }
     $mail->IsHTML(true);
     // send as HTML
     if (!$mail->Send()) {
         return false;
     }
     $mail->SmtpClose();
     return true;
 }
开发者ID:whoami15,项目名称:jobbid,代码行数:44,代码来源:sendmail.php

示例11: smtpmailer

function smtpmailer($to, $from, $from_name, $subject, $body)
{
    global $error;
    $username = "info@boom-tools.in";
    //gautam@searchdrivenlabs.com
    $password = "admin123";
    //gautam@searchdrivenlabs.com
    $mail = new PHPMailer();
    // create a new object
    $mail->IsSMTP();
    // enable SMTP
    $mail->SMTPDebug = 1;
    // debugging: 1 = errors and messages, 2 = messages only
    $mail->SMTPAuth = true;
    // authentication enabled
    $mail->SMTPSecure = 'ssl';
    // secure transfer enabled REQUIRED for GMail
    $mail->Host = 'rsb21.rhostbh.com';
    $mail->Port = 465;
    $mail->Username = $username;
    $mail->Password = $password;
    $mail->Priority = 1;
    // Highest priority - Email priority (1 = High, 3 = Normal, 5 = low)
    $mail->CharSet = 'UTF-8';
    $mail->Encoding = '8bit';
    $mail->ContentType = 'text/html; charset=utf-8\\r\\n';
    $mail->SetFrom($from, $from_name);
    $mail->Subject = $subject;
    $mail->Body = $body;
    $mail->AddAddress($to);
    $mail->IsHTML(true);
    $mail->WordWrap = 900;
    $mail->SMTPKeepAlive = true;
    if (!$mail->Send()) {
        $error = 'Mail error: ' . $mail->ErrorInfo;
        return false;
    } else {
        $error = 'Message sent!';
        $mail->SmtpClose();
        return true;
    }
}
开发者ID:bhushansonar,项目名称:choosy_kids,代码行数:42,代码来源:forgot-password.php

示例12: email

function email($fromName, $to, $subject, $body)
{
    require_once 'class.phpmailer.php';
    $Mail = new PHPMailer();
    $Mail->IsSMTP();
    $Mail->Host = "hostname.com";
    //SMTP server
    $Mail->SMTPDebug = 0;
    $Mail->SMTPAuth = TRUE;
    $Mail->SMTPSecure = "tls";
    $Mail->Port = 587;
    //SMTP port
    $Mail->Username = 'username';
    //SMTP account username
    $Mail->Password = 'password';
    //SMTP account password
    $Mail->Priority = 1;
    $Mail->CharSet = 'UTF-8';
    $Mail->Encoding = '8bit';
    $Mail->Subject = $subject;
    $Mail->ContentType = 'text/html; charset=utf-8\\r\\n';
    $Mail->From = 'email@domain.com';
    $Mail->FromName = $fromName;
    $Mail->WordWrap = 900;
    $Mail->AddAddress($to);
    $Mail->isHTML(TRUE);
    $Mail->Body = $body;
    $Mail->AltBody = $body;
    $Mail->Send();
    $Mail->SmtpClose();
    if ($Mail->IsError()) {
        return 'emailNotSent';
    } else {
        return 'emailSent';
    }
}
开发者ID:yunsite,项目名称:devana-heroic,代码行数:36,代码来源:email.php

示例13: sendMail

 public function sendMail($email, $subject, $msg = NULL)
 {
     global $websiteName, $emailAddress;
     //Check to see if we sending a template email.
     $message = '';
     if ($msg == NULL) {
         $msg = $this->contents;
     }
     $message .= $msg;
     $message = wordwrap($message, 70);
     $mail = new PHPMailer();
     $mail->IsSMTP();
     // Use SMTP
     $mail->Host = "mail.criticlash.com";
     // Sets SMTP server
     //$mail->SMTPDebug   = 1; // 2 to enable SMTP debug information
     $mail->SMTPAuth = TRUE;
     // enable SMTP authentication
     //$mail->SMTPSecure  = "tls"; //Secure conection
     $mail->Port = '25';
     // set the SMTP port
     $mail->Username = 'info@criticlash.com';
     // SMTP account username
     $mail->Password = 'CritiClash2015!';
     // SMTP account password
     $mail->Priority = 1;
     // Highest priority - Email priority (1 = High, 3 = Normal, 5 = low)
     $mail->CharSet = 'UTF-8';
     $mail->Encoding = '8bit';
     $mail->Subject = $subject;
     $mail->ContentType = 'text/html; charset=utf-8\\r\\n';
     //$mail->From        = $emailAddress;
     $mail->FromName = $websiteName;
     $mail->AddAddress($email);
     // To:
     $mail->isHTML(TRUE);
     $mail->Body = $message;
     $mail->AltBody = $message;
     if (!$mail->Send()) {
         return false;
     } else {
         return true;
     }
     $mail->SmtpClose();
     //return mail($email,$subject,$message,$header);
 }
开发者ID:davidvdtak,项目名称:AIRdb,代码行数:46,代码来源:class.mail.php

示例14: send_mail_through_queue

function send_mail_through_queue($to, $cc, $bcc, $subject, $body, $file_list)
{
    // copy attachment file in common shared folder accross the machines
    $attach_file = array();
    foreach ($file_list as $file) {
        global $attach_folder;
        $copy_file = copy($file['path'], $attach_folder . $file['file_name']);
        $file_array = array("path" => $attach_folder . $file['file_name'], "file_name" => $file['file_name']);
        array_push($attach_file, $file_array);
    }
    // parameter sending over queue for sending email
    $requestParams = array("to" => $to, "cc" => $cc, "bcc" => $bcc, "subject" => $subject, "body" => $body, "file_list" => $attach_file);
    $msg = json_encode($requestParams);
    global $email_purpose;
    $push_msg_over_queue = push_to_queue($email_purpose, $msg);
    if (!$push_msg_over_queue) {
        require_once "class.phpmailer.php";
        $mail = new PHPMailer();
        foreach ($cc_li as $cc_list) {
            if ($cc_list != "") {
                $mail->AddCC($cc_list);
            }
        }
        foreach ($bcc_li as $bcc_list) {
            if ($bcc_list != "") {
                $mail->AddBCC($bcc_list);
            }
        }
        if (!empty($file_list)) {
            foreach ($file_list as $file_list) {
                $path = $file_list['path'];
                $file_name = $file_list['file_name'];
                $mail->AddAttachment("{$path}", "{$file_name}", "base64", "application/octet-stream");
            }
        }
        $mail->IsHTML(true);
        $mail->IsSMTP();
        $mail->SMTPAuth = true;
        global $smtp_host, $smtp_port, $smtpfrom, $smtp_fromname, $smtp_user_name, $smtp_pswd;
        $mail->Host = $smtp_host;
        $mail->Port = $smtp_port;
        $mail->From = $smtpfrom;
        $mail->FromName = $smtp_fromname;
        $mail->Username = $smtp_user_name;
        $mail->Password = $smtp_pswd;
        foreach ($to as $to_list) {
            $mail->AddAddress($to_list);
        }
        $mail->Subject = $subject;
        $mail->Body = $body;
        creteLogs(__FILE__, __LINE__, "email send with");
        $send_email = $mail->Send();
        if ($send_email == TRUE) {
            creteLogs(__FILE__, __LINE__, "mail send");
        }
        $mail->SmtpClose();
    }
}
开发者ID:gaurav-kranti-clearmydues,项目名称:uatportalweb,代码行数:58,代码来源:functions.php

示例15: sendEmail

 /**
  * 发送邮件
  * @param $to  接收邮件的帐号,以逗号分隔
  * @param $subject  邮件标题
  * @param $message  邮件内容
  * @param $host 发件服务器地址
  * @param $username 发件人邮箱用户名
  * @param $password 发件人邮箱密码
  * @param $attachment = false 邮件附件 array('附件路径','附件名称')
  * @return mixed bool 是否发送成功
  */
 public static function sendEmail($to, $subject, $message, $host, $username, $password, $attachment = false)
 {
     set_time_limit(0);
     Yii::import('application.extensions.mailer.PHPMailerAutoload', 1);
     $mail = new PHPMailer();
     $mail->IsSMTP();
     // set mailer to use SMTP
     $mail->Host = $host;
     // 发件服务器地址
     $mail->SMTPAuth = true;
     // turn on SMTP authentication
     $mail->Port = 25;
     // 发件服务器端口
     $mail->Username = $username;
     // 发件人邮箱用户名
     $mail->Password = $password;
     // 发件人邮箱密码
     $mail->From = $username;
     // 发件人邮箱
     $mail->FromName = '百程系统邮件';
     // 发件人姓名
     $toArr = explode(',', $to);
     foreach ($toArr as $toEmail) {
         $mail->AddAddress($toEmail, $toEmail);
         // 收件人邮箱地址
     }
     $mail->IsHTML(true);
     $mail->Subject = $subject;
     // 邮件标题
     $mail->Body = $message;
     // 是否带有附件
     if (!empty($attachment) && is_array($attachment)) {
         $mail->AddAttachment($attachment[0], $attachment[1]);
     }
     $mail->AltBody = "text/html";
     $mail->CharSet = "utf-8";
     //设置字符集编码
     return $mail->Send();
     $mail->SmtpClose();
 }
开发者ID:lovecheng,项目名称:brs-demo2,代码行数:51,代码来源:Email.php


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