Jump to content

3 email address in mail()


themistral

Recommended Posts

Hi guys,

 

I am having a problem - I have the following code:

 

$to = '[email protected]'.', ';
$to .= '[email protected]'.', ';
$to .= '[email protected]';

 

When I use

mail($to, $subject, $body, $from);

the 3 recipients do not receive the email. If I take out the 2nd recipient it works fine!

 

Can anyone shed any light?

 

Thanks in advance!

Link to comment
https://forums.phpfreaks.com/topic/165795-3-email-address-in-mail/
Share on other sites

$to should contain only one e-mail address. All other e-mail address should be added to cc or bcc through the use of $headers.

 

Not true.  You can have multiple email addresses in the "to:". 

 

From the manual: mail()

to

 

    Receiver, or receivers of the mail.

 

    The formatting of this string must comply with » RFC 2822. Some examples are:

 

        * [email protected]

        * [email protected], [email protected]

        * User <[email protected]>

        * User <[email protected]>, Another User <[email protected]>

 

My guess is your 2nd one is probably an invalid email address.  Or else maybe all 3 are to same domain and having more than 2 triggers a spam filter or something. 

The destination fields of a message consist of three possible fields,

each of the same form: The field name, which is either "To", "Cc", or

"Bcc", followed by a comma-separated list of one or more addresses

(either mailbox or group syntax). -- http://www.faqs.org/rfcs/rfc2822.html

 

Like Crayon already mentioned most likely spam filters block any mails with multiple to e-mail addresses. Therefor I suggest to add 1 to and to spread all others to cc and bcc.

$to should contain only one e-mail address. All other e-mail address should be added to cc or bcc through the use of $headers.

 

Not true.  You can have multiple email addresses in the "to:". 

 

From the manual: mail()

to

 

    Receiver, or receivers of the mail.

 

    The formatting of this string must comply with » RFC 2822. Some examples are:

 

        * [email protected]

        * [email protected], [email protected]

        * User <[email protected]>

        * User <[email protected]>, Another User <[email protected]>

 

Yeah I know. But I couldn't edit my post anymore.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.