繁体   English   中英

有CC的PHP脚本发送两封电子邮件

[英]PHP script sending two emails when there is a CC

第一封电子邮件只给我,第二封电子邮件是我和抄送的副本。 没有密件抄送。

电子邮件代码:

$to = 'to@email.com';
$subject = 'Email';
$message = '<html><body><p>Hello from me!<br>';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers = $headers . 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers = $headers . 'From: from@email.com' . "\r\n";
$headers = $headers . 'Reply-To: from@email.com' . "\r\n";
$headers = $headers . 'CC: cc@email.com' . "\r\n";
mail($to, $subject, $message, $headers);

如您所见,只有一个抄送和一个“收件人”地址。 我不认为这是PHP.ini文件:

[PHP]

engine = On

max_execution_time = 60     ;
 Maximum execution time of each script, in seconds 
max_input_time = 120    ;
 Maximum amount of time each script may spend parsing request data
memory_limit = 128M      ; 
Maximum amount of memory a script may consume (8MB)

post_max_size = 150M

default_mimetype = "text/html"

default_charset = "UTF-8"

file_uploads = On

upload_max_filesize = 150M

allow_url_fopen = On

user_agent="PHP"

default_socket_timeout = 60

cgi.fix_pathinfo = 1

cgi.fix_pathinfo = 1

但是有。 为什么我会加倍?

我建议您使用电子邮件处理库,例如Swift Mailer。 它比将您自己的标头串在一起要好得多。

http://swiftmailer.org/

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM