themistral Posted July 13, 2009 Share Posted July 13, 2009 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 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. 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? 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: * [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. 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! 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. 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: * [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. 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
Archived
This topic is now archived and is closed to further replies.