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


PHP PHPMailer::addCC方法代码示例

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


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

示例1: email

/**
 * email function
 *
 * @return bool | void
 **/
function email($to, $from_mail, $from_name, $subject, $message)
{
    require '../../PHPMailer/PHPMailerAutoload.php';
    $mail = new PHPMailer();
    $mail->From = $from_mail;
    $mail->FromName = $from_name;
    $mail->addAddress($to, $from_name);
    // Add a recipient
    $mail->addCC('');
    //Optional ; Use for CC
    $mail->addBCC('');
    //Optional ; Use for BCC
    $mail->WordWrap = 50;
    // Set word wrap to 50 characters
    $mail->isHTML(true);
    // Set email format to HTML
    //Remove below comment out code for SMTP stuff, otherwise don't touch this code.
    /*  
    $mail->isSMTP();
    $mail->Host = "mail.example.com";  //Set the hostname of the mail server
    $mail->Port = 25;  //Set the SMTP port number - likely to be 25, 465 or 587
    $mail->SMTPAuth = true;  //Whether to use SMTP authentication
    $mail->Username = "yourname@example.com"; //Username to use for SMTP authentication
    $mail->Password = "yourpassword"; //Password to use for SMTP authentication
    */
    $mail->Subject = $subject;
    $mail->Body = $message;
    if ($mail->send()) {
        return true;
    }
}
开发者ID:hugoferreiraads,项目名称:site,代码行数:36,代码来源:sendemail.php

示例2: cc

 /**
  * Adds to the "Cc" recipient collection.
  *
  * @param mixed $RecipientEmail An email (or array of emails) to add to the "Cc" recipient collection.
  * @param string $RecipientName The recipient name associated with $RecipientEmail. If $RecipientEmail is
  * an array of email addresses, this value will be ignored.
  * @return Email
  */
 public function cc($RecipientEmail, $RecipientName = '')
 {
     ob_start();
     $this->PhpMailer->addCC($RecipientEmail, $RecipientName);
     ob_end_clean();
     return $this;
 }
开发者ID:karanjitsingh,项目名称:iecse-forum,代码行数:15,代码来源:class.email.php

示例3: send

 public function send()
 {
     $mail = new \PHPMailer();
     $mail->isSMTP();
     //CONFIGURAÇÕES DO SMTP
     $mail->Host = 'smtp.email.com.br';
     $mail->SMTPAuth = true;
     $mail->Username = 'email@email.com.br';
     $mail->Password = '********';
     $mail->Port = 587;
     //E-MAIL DESTIMO E CC
     $this->setTo("email@email.com.br");
     $mail->addCC("email@email.com.br");
     $mail->From = 'email@email.com.br';
     $mail->FromName = 'Assunto';
     $mail->addAddress($this->getTo(), '');
     $mail->Subject = $this->getSubject();
     $mail->msgHTML($this->templateMail($this->getTemplate(), $this->getDataEmail()));
     $mail->isHTML(true);
     $msg = "";
     if (!$mail->send()) {
         $msg += 'Message could not be sent.';
         $msg += 'Mailer Error: ' . $mail->ErrorInfo;
     } else {
         $msg += 'Message has been sent';
     }
     return $msg;
 }
开发者ID:rederlo,项目名称:Mini_framework,代码行数:28,代码来源:Mail.php

示例4: testConvertEncoding

 /**
  * Tests CharSet and Unicode -> ASCII conversions for addresses with IDN.
  */
 public function testConvertEncoding()
 {
     if (!$this->Mail->idnSupported()) {
         $this->markTestSkipped('intl and/or mbstring extensions are not available');
     }
     $this->Mail->clearAllRecipients();
     $this->Mail->clearReplyTos();
     // This file is UTF-8 encoded. Create a domain encoded in "iso-8859-1".
     $domain = '@' . mb_convert_encoding('françois.ch', 'ISO-8859-1', 'UTF-8');
     $this->Mail->addAddress('test' . $domain);
     $this->Mail->addCC('test+cc' . $domain);
     $this->Mail->addBCC('test+bcc' . $domain);
     $this->Mail->addReplyTo('test+replyto' . $domain);
     // Queued addresses are not returned by get*Addresses() before send() call.
     $this->assertEmpty($this->Mail->getToAddresses(), 'Bad "to" recipients');
     $this->assertEmpty($this->Mail->getCcAddresses(), 'Bad "cc" recipients');
     $this->assertEmpty($this->Mail->getBccAddresses(), 'Bad "bcc" recipients');
     $this->assertEmpty($this->Mail->getReplyToAddresses(), 'Bad "reply-to" recipients');
     // Clear queued BCC recipient.
     $this->Mail->clearBCCs();
     $this->buildBody();
     $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
     // Addresses with IDN are returned by get*Addresses() after send() call.
     $domain = $this->Mail->punyencodeAddress($domain);
     $this->assertEquals([['test' . $domain, '']], $this->Mail->getToAddresses(), 'Bad "to" recipients');
     $this->assertEquals([['test+cc' . $domain, '']], $this->Mail->getCcAddresses(), 'Bad "cc" recipients');
     $this->assertEmpty($this->Mail->getBccAddresses(), 'Bad "bcc" recipients');
     $this->assertEquals(['test+replyto' . $domain => ['test+replyto' . $domain, '']], $this->Mail->getReplyToAddresses(), 'Bad "reply-to" addresses');
 }
开发者ID:jbs321,项目名称:portfolio,代码行数:32,代码来源:phpmailerTest.php

示例5: testAddressing

 /**
  * Test addressing.
  */
 public function testAddressing()
 {
     $this->assertFalse($this->Mail->addAddress(''), 'Empty address accepted');
     $this->assertFalse($this->Mail->addAddress('', 'Nobody'), 'Empty address with name accepted');
     $this->assertFalse($this->Mail->addAddress('a@example..com'), 'Invalid address accepted');
     $this->assertTrue($this->Mail->addAddress('a@example.com'), 'Addressing failed');
     $this->assertFalse($this->Mail->addAddress('a@example.com'), 'Duplicate addressing failed');
     $this->assertTrue($this->Mail->addCC('b@example.com'), 'CC addressing failed');
     $this->assertFalse($this->Mail->addCC('b@example.com'), 'CC duplicate addressing failed');
     $this->assertFalse($this->Mail->addCC('a@example.com'), 'CC duplicate addressing failed (2)');
     $this->assertTrue($this->Mail->addBCC('c@example.com'), 'BCC addressing failed');
     $this->assertFalse($this->Mail->addBCC('c@example.com'), 'BCC duplicate addressing failed');
     $this->assertFalse($this->Mail->addBCC('a@example.com'), 'BCC duplicate addressing failed (2)');
     $this->assertTrue($this->Mail->addReplyTo('a@example.com'), 'Replyto Addressing failed');
     $this->assertFalse($this->Mail->addReplyTo('a@example..com'), 'Invalid Replyto address accepted');
     $this->assertTrue($this->Mail->setFrom('a@example.com', 'some name'), 'setFrom failed');
     $this->assertFalse($this->Mail->setFrom('a@example.com.', 'some name'), 'setFrom accepted invalid address');
     $this->Mail->Sender = '';
     $this->Mail->setFrom('a@example.com', 'some name', true);
     $this->assertEquals($this->Mail->Sender, 'a@example.com', 'setFrom failed to set sender');
     $this->Mail->Sender = '';
     $this->Mail->setFrom('a@example.com', 'some name', false);
     $this->assertEquals($this->Mail->Sender, '', 'setFrom should not have set sender');
     $this->Mail->clearCCs();
     $this->Mail->clearBCCs();
     $this->Mail->clearReplyTos();
 }
开发者ID:ahmedash95,项目名称:Lily,代码行数:30,代码来源:phpmailerTest.php

示例6: 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

示例7: 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

示例8: populateMessage

 /**
  * Populate the email message
  */
 private function populateMessage()
 {
     $attributes = $this->attributes;
     $this->mailer->CharSet = 'UTF-8';
     $this->mailer->Subject = $attributes['subject'];
     $from_parts = Email::explodeEmailString($attributes['from']);
     $this->mailer->setFrom($from_parts['email'], $from_parts['name']);
     $to = Helper::ensureArray($this->attributes['to']);
     foreach ($to as $to_addr) {
         $to_parts = Email::explodeEmailString($to_addr);
         $this->mailer->addAddress($to_parts['email'], $to_parts['name']);
     }
     if (isset($attributes['cc'])) {
         $cc = Helper::ensureArray($attributes['cc']);
         foreach ($cc as $cc_addr) {
             $cc_parts = Email::explodeEmailString($cc_addr);
             $this->mailer->addCC($cc_parts['email'], $cc_parts['name']);
         }
     }
     if (isset($attributes['bcc'])) {
         $bcc = Helper::ensureArray($attributes['bcc']);
         foreach ($bcc as $bcc_addr) {
             $bcc_parts = Email::explodeEmailString($bcc_addr);
             $this->mailer->addBCC($bcc_parts['email'], $bcc_parts['name']);
         }
     }
     if (isset($attributes['html'])) {
         $this->mailer->msgHTML($attributes['html']);
         if (isset($attributes['text'])) {
             $this->mailer->AltBody = $attributes['text'];
         }
     } elseif (isset($attributes['text'])) {
         $this->mailer->msgHTML($attributes['text']);
     }
 }
开发者ID:andorpandor,项目名称:git-deploy.eu2.frbit.com-yr-prototype,代码行数:38,代码来源:phpmailer.php

示例9: mysqli

 function mail_register_compose($email_address)
 {
     include 'db_login.php';
     $db = new mysqli($db_host, $db_username, $db_password, $db_database);
     $db->set_charset("utf8");
     if ($db->connect_errno > 0) {
         die('Unable to connect to database [' . $db->connect_error . ']');
     }
     // Send mail to the pilot
     //  Get VA email configuration
     $sql = "select * from va_parameters";
     if (!($result = $db->query($sql))) {
         die('There was an error running the query [' . $db->error . ']');
     }
     while ($row = $result->fetch_assoc()) {
         $va_name = $row["va_name"];
     }
     $sql = "select * from config_emails";
     if (!($result = $db->query($sql))) {
         die('There was an error running the query [' . $db->error . ']');
     }
     while ($row = $result->fetch_assoc()) {
         $staff_email = $row["staff_email"];
         $ceo_email = $row["ceo_email"];
         $cc_email_1 = $row["cc_email_1"];
         $register_text = $row["register_text"];
     }
     $mail = new PHPMailer();
     $mail->addReplyTo($staff_email, 'VAM system');
     $mail->From = $staff_email;
     $mail->FromName = $va_name . ' VAM system';
     $mail->addAddress($email_address);
     $mail->addCC($ceo_email);
     $mail->addCC($cc_email_1);
     $mail->addBCC('va_manager@gmail.com');
     $mail->isHTML(true);
     // Set email format to HTML
     $mail->Subject = 'Welcome to ' . $va_name;
     $mail->Body = $register_text . '</b>';
     $mail->AltBody = $register_text;
     if (!$mail->send()) {
         echo 'Message could not be sent.';
         echo 'Mailer Error: ' . $mail->ErrorInfo;
     } else {
         echo '';
     }
 }
开发者ID:Newsoft-Computer,项目名称:CLI0005-IVAO-Colombia,代码行数:47,代码来源:class_vam_mailer.php

示例10: sendMailSMTP

 /**
  * @name sendMailSMTP This function send mail via SMPT authenticated
  * @param array $userData Configuration with user data
  * @param string $subject Subject of message
  * @param string $body Body
  * @param array $to Emails who recieve the email
  * @param array $cc Emails with copy
  * @param array $bcc Emails with hidden copy
  * @return boolean
  */
 static function sendMailSMTP($userData, $subject, $body, $to = array(), $cc = array(), $bcc = array())
 {
     require_once kw::$dir . 'extensions/Mailer/phpmailer/PHPMailerAutoload.php';
     $mail = new PHPMailer();
     $mail->isSMTP();
     // Set mailer to use SMTP
     $mail->Host = $userData['host'];
     // Specify main and backup SMTP servers
     $mail->SMTPAuth = true;
     // Enable SMTP authentication
     $mail->Username = $userData['username'];
     // SMTP username
     $mail->Password = $userData['password'];
     // SMTP password
     $mail->SMTPSecure = 'tls';
     // Enable encryption, 'ssl' also accepted
     $mail->From = $userData['from'];
     $mail->FromName = $userData['fromName'];
     if (!empty($to)) {
         foreach ($to as $receiver) {
             $mail->addAddress($receiver);
             // Add a recipient
         }
     }
     if (!empty($cc)) {
         foreach ($cc as $receiver) {
             $mail->addCC($receiver);
             // Add a recipient
         }
     }
     if (!empty($bcc)) {
         foreach ($bcc as $receiver) {
             $mail->addBCC($receiver);
             // Add a recipient
         }
     }
     /*$mail->addAddress('ellen@example.com');               // Name is optional
     		$mail->addReplyTo('info@example.com', 'Information');
     		$mail->addCC('cc@example.com');
     		$mail->addBCC('bcc@example.com');*/
     $mail->WordWrap = 50;
     // Set word wrap to 50 characters
     //$mail->addAttachment('/var/tmp/file.tar.gz');         // Add attachments
     //$mail->addAttachment('/tmp/image.jpg', 'new.jpg');    // Optional name
     $mail->isHTML(true);
     // Set email format to HTML
     $mail->Subject = $subject;
     $mail->Body = $body;
     $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
     if (!$mail->send()) {
         //echo 'Message could not be sent.';
         echo 'Mailer Error: ' . $mail->ErrorInfo;
         return false;
     } else {
         return true;
     }
 }
开发者ID:JosepRivaille,项目名称:StyleCombo,代码行数:67,代码来源:Mailer.php

示例11: cc

 /**
  * Adds to the "Cc" recipient collection.
  *
  * @param mixed $RecipientEmail An email (or array of emails) to add to the "Cc" recipient collection.
  * @param string $RecipientName The recipient name associated with $RecipientEmail. If $RecipientEmail is
  * an array of email addresses, this value will be ignored.
  * @return Email
  */
 public function cc($RecipientEmail, $RecipientName = '')
 {
     if ($RecipientName != '' && c('Garden.Email.OmitToName', false)) {
         $RecipientName = '';
     }
     ob_start();
     $this->PhpMailer->addCC($RecipientEmail, $RecipientName);
     ob_end_clean();
     return $this;
 }
开发者ID:korelstar,项目名称:vanilla,代码行数:18,代码来源:class.email.php

示例12: testmail

 public function testmail()
 {
     //defaults to using php "mail()";
     // the true param means it will throw exceptions on errors, which we need to catch
     $mail = new PHPMailer(true);
     // Enable verbose debug output
     //$mail->SMTPDebug = 3;
     // Set mailer to use SMTP
     $mail->isSMTP();
     // Specify main and backup SMTP servers
     $mail->Host = 'smtp.gmail.com';
     // Enable SMTP authentication
     $mail->SMTPAuth = true;
     // SMTP username
     $mail->Username = 'Munasinghets93@gmail.com';
     // SMTP password
     $mail->Password = 'ThisIsTotallyMyPassWord!';
     // Enable TLS encryption, `ssl` also accepted
     $mail->SMTPSecure = 'ssl';
     // TCP port to connect to
     $mail->Port = 465;
     //Error handling
     try {
         $mail->setFrom('from@example.com', 'Mailer');
         // Add a recipient
         $mail->addAddress('Munasinghets93@gmail.com', 'Joe User');
         // Name is optional
         $mail->addAddress('ellen@example.com');
         $mail->addReplyTo('info@example.com', 'Information');
         $mail->addCC('cc@example.com');
         $mail->addBCC('bcc@example.com');
         //$mail->addAttachment('/var/tmp/file.tar.gz');         // Add attachments
         //$mail->addAttachment('/tmp/image.jpg', 'new.jpg');    // Optional name
         $mail->isHTML(true);
         // Set email format to HTML
         $mail->Subject = 'Here is the subject';
         $mail->Body = 'This is the HTML message body <b>in bold!</b>';
         $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
         if (!$mail->send()) {
             echo 'Message could not be sent.';
             //echo 'Mailer Error: ' . $mail->ErrorInfo;
         } else {
             echo 'Message has been sent';
         }
     } catch (phpmailerException $e) {
         //Added custom message when this error is encountered.
         echo "<h3>Unable to send message</h3><br/><h4>Check your internet connection</h4></br></br>";
         //The actual details of the error will be shown here.
         echo "PHPMailer error - " . $e->errorMessage();
         //Pretty error messages from PHPMailer
     } catch (Exception $e) {
         echo $e->getMessage();
     }
 }
开发者ID:MunasingheTS,项目名称:SEP_Event_Planning_3.0,代码行数:54,代码来源:controller_emails.php

示例13: setAddress

 /**
  * Adds all of the addresses
  * @access public
  * @param string $sAddress
  * @param string $sName
  * @param string $sType
  * @return boolean
  */
 public function setAddress($sAddress, $sName = '', $sType = 'to')
 {
     switch ($sType) {
         case 'to':
             return $this->Mail->addAddress($sAddress, $sName);
         case 'cc':
             return $this->Mail->addCC($sAddress, $sName);
         case "bcc":
             return $this->Mail->addBCC($sAddress, $sName);
     }
     return false;
 }
开发者ID:vinodbeloshe12,项目名称:afile,代码行数:20,代码来源:phpmailerLangTest.php

示例14: smtp_mail

/**
 * This hook function is called when send mail.
 * @param $mail_info 
 * An array contains mail information : to,cc,bcc,subject,message
 **/
function smtp_mail($mail_info)
{
    /* include phpmailer library */
    require dirname(__FILE__) . "/phpmailer/class.phpmailer.php";
    require dirname(__FILE__) . "/phpmailer/class.smtp.php";
    /* create mail_log table if it doesn't exist */
    $database_tabels = str_split(sqlValue("SHOW TABLES"));
    $exist = in_array('mail_log', $database_tabels) ? True : False;
    if (!$exist) {
        $sql = "CREATE TABLE IF NOT EXISTS `mail_log` (\r\n\t\t\t\t\t`mail_id` int(15) NOT NULL AUTO_INCREMENT,\r\n\t\t\t\t\t`to` varchar(225) NOT NULL,\r\n\t\t\t\t\t`cc` varchar(225) NOT NULL,\r\n\t\t\t\t\t`bcc` varchar(225) NOT NULL,\r\n\t\t\t\t\t`subject` varchar(225) NOT NULL,\r\n\t\t\t\t\t`body` text NOT NULL,\r\n\t\t\t\t\t`senttime` int(15) NOT NULL,\r\n\t\t\t\t\tPRIMARY KEY (`mail_id`)\r\n\t\t\t\t   ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;\r\n\t\t\t\t   ";
        sql($sql, $eo);
    }
    /* SMTP configuration*/
    $mail = new PHPMailer();
    $mail->isSMTP();
    // telling the class to use SMTP
    $mail->SMTPAuth = true;
    // Enable SMTP authentication
    $mail->isHTML(true);
    // Set email format to HTML
    $mail->SMTPDebug = 0;
    // Enable verbose debug output
    $mail->Username = SMTP_USER;
    // SMTP username
    $mail->Password = SMTP_PASSWORD;
    // SMTP password
    $mail->SMTPSecure = SMTP_SECURE;
    // Enable TLS encryption, `ssl` also accepted
    $mail->Port = SMTP_PORT;
    // TCP port to connect to
    $mail->FromName = SMTP_FROM_NAME;
    $mail->From = SMTP_FROM;
    $mail->Host = SMTP_SERVER;
    // SMTP server
    $mail->setFrom(SMTP_FROM, SMTP_FROM_NAME);
    /* send to */
    $mail->addAddress($mail_info['to']);
    $mail->addCC($mail_info['cc']);
    $mail->addBCC(SMTP_BCC);
    $mail->Subject = $mail_info['subject'];
    $mail->Body = $mail_info['message'];
    if (!$mail->send()) {
        return FALSE;
    }
    /* protect against malicious SQL injection attacks */
    $to = makeSafe($mail_info['to']);
    $cc = makeSafe($mail_info['cc']);
    $bcc = makeSafe(SMTP_BCC);
    $subject = makeSafe($mail_info['subject']);
    $message = makeSafe($mail_info['message']);
    sql("INSERT INTO `mail_log` (`to`,`cc`,`bcc`,`subject`,`body`,`senttime`) VALUES ('{$to}','{$cc}','{$bcc}','{$subject}','{$message}',unix_timestamp(NOW()))", $eo);
    return TRUE;
}
开发者ID:bigprof,项目名称:jaap,代码行数:58,代码来源:__global.php

示例15: customMail

function customMail($host, $user, $pass, $port, $secure, $fromMail, $fromName, $toMailList, $replyTo, $subject, $body, $bodyTxt = '', $ccList = '', $bccList = '')
{
    require 'PHPMailerAutoload.php';
    $mail = new PHPMailer();
    $mail->CharSet = 'UTF-8';
    //$mail->SMTPDebug = 3;                 // Enable verbose debug output
    $mail->isSMTP();
    // Set mailer to use SMTP
    $mail->Host = $host;
    // Specify main and backup SMTP servers
    $mail->SMTPAuth = true;
    // Enable SMTP authentication
    $mail->Username = $user;
    // SMTP username
    $mail->Password = $pass;
    // SMTP password
    $mail->SMTPSecure = $secure;
    // Enable TLS encryption (port 587), `ssl` also accepted (port 465)
    $mail->Port = $port;
    // TCP port to connect to
    $mail->From = $fromMail;
    $mail->FromName = $fromName;
    //To email
    foreach ($toMailList as $send) {
        $mail->addAddress($send);
    }
    //Reply to
    $mail->addReplyTo($replyTo);
    //CC
    foreach ($ccList as $cc) {
        $mail->addCC($cc);
    }
    //BCC
    foreach ($bccList as $bcc) {
        $mail->addBCC($bcc);
    }
    $mail->Subject = $subject;
    $mail->Body = html_entity_decode($body);
    $mail->AltBody = $bodyTxt;
    //'This is the body in plain text for non-HTML mail clients';
    $mail->IsHTML(true);
    // Set email format to HTML
    if ($mail->send()) {
        $res = '';
    } else {
        $res .= 'Mailer Error: ' . $mail->ErrorInfo;
    }
    return $res;
}
开发者ID:golfcrseven,项目名称:scsuper,代码行数:49,代码来源:sendMail.php


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