用phpmailer发送电子邮件

时间:2018-02-01 16:57:52

标签: php phpmailer

我是PHPMAILER的新手 我想从文本文件而不是sql db发送大约200封电子邮件, 我正在使用github中的常规示例     

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

//Load composer's autoloader
require 'vendor/autoload.php';

$mail = new PHPMailer(true);                              // Passing `true` enables exceptions
try {
    //Server settings
    $mail->SMTPDebug = 1;                                 // Enable verbose debug output
    $mail->isSMTP();                                      // Set mailer to use SMTP
    $mail->Host = 'server';  // Specify main and backup SMTP servers
    $mail->SMTPAuth = true;                               // Enable SMTP authentication
    $mail->Username = 'user';                 // SMTP username
    $mail->Password = 'fbzA2qMk2pNn';                           // SMTP password
    $mail->SMTPSecure = 'tls';                            // Enable TLS encryption, `ssl` also accepted
    $mail->Port = 587;                                    // TCP port to connect to
  $mail->setFrom('test@test.com', 'test');

$mail->addAddress('email@email.com'); 
  etc

如何向addAddress()添加约200/1000封电子邮件?

0 个答案:

没有答案