小编use*_*437的帖子

如何在php中第二次发送不同的邮件时删除附件表单phpmailer

在php文件中,我需要向2个不同的id发送2个不同的电子邮件.当我使用如下所示的两个变量时,它不起作用.

require 'PHPmailer/class.phpmailer.php';

/* First Email*/

$email = new PHPMailer();
$email->From      = 'admin@mywebsite.com';
$email->FromName  = 'My Webisite';
$email->Subject   = 'Subject of first email';
$email->Body      = 'Body of the message to first person';
$email->AddAddress( 'to first person' );

$file_to_attach = 'path of the file';       
$email->AddAttachment( $file_to_attach, '' );

$email->Send();

/* Second Email*/

require 'PHPmailer/class.phpmailer.php';
$confirm = new PHPMailer();
$confirm-> From      = 'noreply@mywebsite.com';
$confirm-> FromName  = 'Admin @ MyWebsite';
$confirm-> Subject   = 'Subject of second email';
$confirm-> Body      = 'Body of second …
Run Code Online (Sandbox Code Playgroud)

php email attachment phpmailer

1
推荐指数
2
解决办法
5287
查看次数

标签 统计

attachment ×1

email ×1

php ×1

phpmailer ×1