By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 1,438 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

help with sending mail by looping through array of the TO field

P: n/a
I have an array called $addresses containing all the email addresses of
people to receive an email. Does the following code look like it should
work? Does the the foreach loop look correct?

$subject = "Please complete this paper";
$message = '
You have been invited to the department's annual social on Dec 19.

Please RSVP by Dec 3.

Many thanks.';
$headers = "From: Dean<Im*******@xyz.edu>\r\n";

foreach ( $addresses as $addr ) {
mail($addr, $subject, $message, $headers);
}
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
NotGiven wrote:
I have an array called $addresses containing all the email addresses of
people to receive an email. Does the following code look like it should
work? Does the the foreach loop look correct?
What hapenned when you tried?

$subject = "Please complete this paper";
$message = '
You have been invited to the department's annual social on Dec 19.

_________________________________________^______
you need to escape this quote!

[snip]

Yes, the foreach looks correct.
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.