themistral Posted July 13, 2009 Share Posted July 13, 2009 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! Quote Link to comment https://forums.phpfreaks.com/topic/165795-3-email-address-in-mail/ Share on other sites More sharing options...
ignace Posted July 13, 2009 Share Posted July 13, 2009 $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. Quote Link to comment https://forums.phpfreaks.com/topic/165795-3-email-address-in-mail/#findComment-874534 Share on other sites More sharing options...
themistral Posted July 13, 2009 Author Share Posted July 13, 2009 Ah OK - can you have multiple cc recipients? Quote Link to comment https://forums.phpfreaks.com/topic/165795-3-email-address-in-mail/#findComment-874537 Share on other sites More sharing options...
.josh Posted July 13, 2009 Share Posted July 13, 2009 $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. Quote Link to comment https://forums.phpfreaks.com/topic/165795-3-email-address-in-mail/#findComment-874558 Share on other sites More sharing options...
themistral Posted July 13, 2009 Author Share Posted July 13, 2009 Ah cool - thanks! The 2nd one is definitely correct! Will have a look into the spam filter idea although I don't think that should be a problem. Cheers! Quote Link to comment https://forums.phpfreaks.com/topic/165795-3-email-address-in-mail/#findComment-874583 Share on other sites More sharing options...
ignace Posted July 19, 2009 Share Posted July 19, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/165795-3-email-address-in-mail/#findComment-878296 Share on other sites More sharing options...
ignace Posted July 19, 2009 Share Posted July 19, 2009 $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. Quote Link to comment https://forums.phpfreaks.com/topic/165795-3-email-address-in-mail/#findComment-878297 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.