The first email goes just to me, and the second is a duplicate to me and the CC. There is no BCC.
emailing code:
$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);
as you can see, there's only one CC, and one 'to' address. I don't think it's the PHP.ini file:
[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
but there it is. Why am I getting doubles?
I suggest you use a email handling library such as Swift Mailer. It handles this kind of thing much better than stringing your own headers together.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.