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

EMAIL FORM TO MULTIPLE ADDRESSES

Status
Not open for further replies.

dadms

Technical User
Mar 8, 2003
67
US
This line works to email to this single email address. How would I email the form to multiple addresses?

Thanx in Advance


$mail_to = "pan@cast.net";

 
There are several ways:[ol A][li]Loop through your recipients, sending an individual email address to each recipient.[/li][li]Use a CC: header[/li][li]Use a BCC: header[/li][/ol]


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
from php.net:

/* recipients */
$to = "mary@example.com" . ", " ; // note the comma
$to .= "kelly@example.com";

 
Just want to make sure that I am clear on your answer since I have 4 people to email to. I would have to loop through the code 4 times to send them an email.
 
dadms:
Yes.

My solution sends an independent email to each recipient. You'll have to loop through the list of emails, sending in each one in turn.

Chacalinc's solution would also require you to loop through all the emails, concatenating the addresses. That solution would send a single email, copies of which would be sent to all recipients.


The difference in the solutions depends on whether you want each of your recipients to see the email address of the others. I generally prefer that they not -- I am often sending emails to large numbers of people, and I don't want to clutter the "To:" field. Also, in this day and age of worms harvesting emails from users' inboxes, you don't want to make it easy for the worm to add to its collection.




Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top