Click to See Complete Forum and Search --> : mail()'ing to multiple addresses?


Anon
10-23-2000, 04:52 PM
I'm running php as CGI under IIS 4.0 on NT. Trying to get mail() to work has given me all sorts of problems... Here's the latest/greatest...

I can't get it to send mail to two addresses in one call to mail(). Here's some code, which should work... but it doesn't, apparently:
mail("user1@domain1.com,user2@domain2.com","subject","message");

I've tried so many different ways of formatting the from string it isn't funny... I've tried with and without <>'s, with and without commas or semicolons... lots of different things. I read RFC822 (on formatting email, basically) and it says that the string right there should be fine... But no.

With some strings (that one being one of them, I believe) I can get the email sent to the second address... but never the first.

In php.ini, SMTP and sendmail_from are set appropriately.

The smtp server is running Solaris. I'm not sure what it's running for smtp. I think it's sendmail. (We tried installing sendmail on the NT host and setting SMTP=localhost, but that just locked up on the mail() function every time until it timed out...)

Any tips would be greatly appreciated, of course...

Thanks.

Anon
10-25-2000, 05:59 PM
Since you use IIS4, there may be a quick fix you can apply:

(1)Enable the SMTP on your IIS4 and use CDO for NT to send emails.
(2)Connect to the CDONTS component:
Here is an example:
<?
$email = new COM("CDONTS.NewMail") or die "Could not create e-mail");
$email->to = "name@domain1.com, name2@domian2.com,...name_n@domain_n.com); $email->from = "me@localhost.com";
$email->subject = "just a subject";
$email->body = "just a message";
$email->send();
?>