Jump to content

3 email address in mail()


themistral

Recommended Posts

Hi guys,

 

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

 

$to = 'email1@domain.com'.', ';
$to .= 'email2@domain.com'.', ';
$to .= 'email3@domain.com';

 

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
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:

 

        * user@example.com

        * user@example.com, anotheruser@example.com

        * User <user@example.com>

        * User <user@example.com>, Another User <anotheruser@example.com>

 

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. 

Link to comment
Share on other sites

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.

Link to comment
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:

 

        * user@example.com

        * user@example.com, anotheruser@example.com

        * User <user@example.com>

        * User <user@example.com>, Another User <anotheruser@example.com>

 

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.