Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending multiple emails using php 1

Status
Not open for further replies.

TrueJoker

Technical User
Jun 14, 2006
115
GB
I have set up a form that once submitted will send the information to an email. Is it possible to send to multiple emails such as the cc: option on the email. e.g.

To: Someone@Somewhere.com
cc: Me@Here.com
Subject: Blah blah blah

I have tried and for some reason it puts the other email into the subject field not the cc: field. Any Ideas or simple solutions. Knowing me it will be a simple solution lol

 
Well the way im coding it is slightly different to that!

Code:
$emess = "Thank you for your registration  ";
$emess .= "\n\nA ID has been set up for you. ";
$emess .= "\n\nYour new ID and password are: ";
$emess .= "\n\nUsername: $newname\nPassword: $newpass";
$emess .= "\n\nIf you have any questions or problems regarding your registration,";
$emess .= " please email webmaster@example.com";
$emess .= "\n\nThank You";
$ehead = "From: member-desk@example.com\r\n";
$subj = "Welcome";
$mailsend = mail("$newname", "$subj", "$emess", "$ehead");

header("Location: new_member.php");

This is a snippet of the code i am using to send the email all i wish to do is be able to add an extra line say taht will then insert an email into the CC: and send once submitted
 
It's not necessary to put the quotes around these variable references:

$mailsend = mail("$newname", "$subj", "$emess", "$ehead");


Have you looked at what the PHP online manual has to say about CC: on the page dealing with the mail function?



Want the best answers? Ask the best questions! TANSTAAFL!
 
Ah that helped thank you very much it is all working now and as i suspected it was a simple solution of adding another $ehead .= "Cc: email@address.com";
 
The PHP online manual is one of the best out there. I always make a point of consulting it before I post questions here.

As the manual warnds, don't forget that SMTP headers should be separated by "\r\n", not just "\n". Some mail servers care about this, others don't, and it's easier to do it the universally-accepted way.



Want the best answers? Ask the best questions! TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top