Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHPMailer SMTP并将邮件副本添加到已发送文件夹中_Smtp_Phpmailer - Fatal编程技术网

PHPMailer SMTP并将邮件副本添加到已发送文件夹中

PHPMailer SMTP并将邮件副本添加到已发送文件夹中,smtp,phpmailer,Smtp,Phpmailer,我正在使用PHPMailer版本5.2.1 我所有的代码都很好用 但我的问题是:在发送邮件后,我想在“已发送”文件夹中添加一份副本 你怎么能做到这一点 多谢各位 $mail = new PHPMailer(true); $mail->IsSMTP(); try { $mail->Host = mail.domain.com; $mail->SMTPAuth = true; $mail->Username = mail@domain.c

我正在使用PHPMailer版本5.2.1

我所有的代码都很好用

但我的问题是:在发送邮件后,我想在“已发送”文件夹中添加一份副本

你怎么能做到这一点

多谢各位

    $mail = new PHPMailer(true);
$mail->IsSMTP();
try {   
    $mail->Host = mail.domain.com;
    $mail->SMTPAuth = true;
    $mail->Username = mail@domain.com;
    $mail->Password = password;
    $mail->SMTPAuth = true;
    $mail->SMTPAutoTLS = false;
    $mail->SMTPOptions = array(
        'ssl' => array(
            'verify_peer' => false,
            'verify_peer_name' => false,
            'allow_self_signed' => true
        )
    );
    //$mail->SingleTo = true;
    $mail->AddReplyTo(email@domain.com); 
    $mail->AddAddress(usermail@user.com); 
    $mail->SetFrom(email@domain.com, Shantia);
    $mail->Subject = Send Mail about product; 
    $mail->AltBody = "Your browser doesn't support, please change and use another browser."; 
    $mail->CharSet = 'UTF-8'; 
    $mail->ContentType = 'text/html'; 
    $mail->MsgHTML($SendMsg); 
    $mail->Send(); 
} 
catch (phpmailerException $e) {
    echo $e->errorMessage(); 
} 
catch (Exception $e) {
    echo $e->getMessage(); 
}

正如我在GitHub上的重复文章中所说的,首先要做的最重要的事情是更新PHPMailer。您正在使用的版本非常旧,有缺陷,并且会给您的服务器带来严重风险。另外,不要禁用证书验证;这是有原因的。