BR
asked on
PHP sending email BCC and CC
I have a web form to send email
I use PHP
I send it like this
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$headers .= "From: www.mypage.com\r\nReply-To: webmaster@mypage.com";
mail($mymail, $subject, $message, $headers, $address);
I like to add CC and BCC,
how can I add it?
I use PHP
I send it like this
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$headers .= "From: www.mypage.com\r\nReply-To: webmaster@mypage.com";
mail($mymail, $subject, $message, $headers, $address);
I like to add CC and BCC,
how can I add it?
ASKER
dear Progressed,
it didn't work..
it didn't work..
$to .= 'recieveremail@domain.com' ;
$subject .= "whats the subject";
// send HTML mail
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
// Additional headers
$headers .= 'To: RECIEVERNAME <reciever@domain.com>' . "\r\n";
$headers .= 'From: www.mypage.com <youremail@domain.com>' . "\r\n";
$headers .= 'Cc: CCemail@domain.com' . "\r\n";
$headers .= 'Bcc: BCCemail@domain' . "\r\n";
mail($to, $subject, $message, $headers);
this is what I got and it works perfect!
$subject .= "whats the subject";
// send HTML mail
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
// Additional headers
$headers .= 'To: RECIEVERNAME <reciever@domain.com>' . "\r\n";
$headers .= 'From: www.mypage.com <youremail@domain.com>' . "\r\n";
$headers .= 'Cc: CCemail@domain.com' . "\r\n";
$headers .= 'Bcc: BCCemail@domain' . "\r\n";
mail($to, $subject, $message, $headers);
this is what I got and it works perfect!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
my guess my last reply did the work... no more replies from topicstarter...
ASKER
Dear Ray_Paseur, and Progressed;
When I write it like this,
$mymail="my1email@mymail.c om";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$headers .= 'To: my1email@mymail.com' . "\r\n";
$headers .= "From: mydomain.com\r\nReply-To: webmaster@mydomain.com";
$headers .= 'Cc: my2emai@mymail.com' . "\r\n";
$headers .= 'Bcc: my3emai@mymail.com' . "\r\n";
mail($mymail, $subject, $message, $headers);
I recieve this email my1email@mymail.com on the To section.
but I can not recieve email2 or email3
thank you
When I write it like this,
$mymail="my1email@mymail.c
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$headers .= 'To: my1email@mymail.com' . "\r\n";
$headers .= "From: mydomain.com\r\nReply-To: webmaster@mydomain.com";
$headers .= 'Cc: my2emai@mymail.com' . "\r\n";
$headers .= 'Bcc: my3emai@mymail.com' . "\r\n";
mail($mymail, $subject, $message, $headers);
I recieve this email my1email@mymail.com on the To section.
but I can not recieve email2 or email3
thank you
ASKER
on the To section of thecoming email I see this email twice "my1email@mymail.com" but CC and BCC parts are empty..
ASKER
if I delete
$headers .= 'To: my1email@mymail.com' . "\r\n";
it still sends the email to :
$mymail="my1email@mymail.c om";
mail($mymail, $subject, $message, $headers, $address);
$headers .= 'To: my1email@mymail.com' . "\r\n";
it still sends the email to :
$mymail="my1email@mymail.c
mail($mymail, $subject, $message, $headers, $address);
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thank you,
it wasn't working because of \r\n
it wasn't working because of \r\n
no problem... glad to be of service :)
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$headers .= "From: www.mypage.com\r\nReply-To: webmaster@mypage.com";
$headers .= 'Cc: yourCC@adress.com' "\n";
$headers .= 'Bcc: yourBCC@adres.com' "\n";
mail($mymail, $subject, $message, $headers, $address);
this should do the trick