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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sending mail to more than one email address

Status
Not open for further replies.

dwilko

Technical User
Feb 20, 2002
113
GB
Hi
Is it possable to send mail to more than one email address in php?

If so what is the code to do it


Thanks

David

________________________________________
I help Where I can, If My advice Dont work Or Is Wrong then tell Me
 
you use the headers to include a CC



----------------------------------------
Sometimes, when my code just won't behave, I take it outside and make it listen to britney spears music, and when it comes back it's really well behaved. I wonder if it's suffering from post tramatic stress syndrome now..
 
so to get it to send to 3 people I just use CC twice or do I need to use BCC?

also is there any way to set the from address?

Thanks

David

________________________________________
I help Where I can, If My advice Dont work Or Is Wrong then tell Me
 
this link should help


----------------------------------------
Sometimes, when my code just won't behave, I take it outside and make it listen to britney spears music, and when it comes back it's really well behaved. I wonder if it's suffering from post tramatic stress syndrome now..
 
Here's my command to send email:

Code:
mail($recipientString, $FinalSubject, $FinalEmailBody, $emailHeaders);

As you can see, each item is a variable. First is where i'm sending the email to, then the subject field for the email, followed by the email body and lastly the other email headers. The headers are where you set the from, cc, bcc, etc, options.

Here's the code, appearing before the above line, that makes my $emailHeaders variable:

Code:
$emailHeaders = ("From: ".$recipientString ."\r\nCc: ".$Requester ."\r\n");

As you can see i'm setting the from field and doing a Cc to send the email to additional addresses. The $Requester variable usually contains one address but you can comma seperate multiple addresses.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top