wpdd
wpdd

Reputation: 456

Email Reply to multiple email addresses

I want to send email reply to multiple email addresses. Actually there are more then one admins and i want that all of these should receive email reply. Right now i am using this

$headers .= "Reply-To: ". [email protected] . "\r\n";

It is working fine for one email address but i do not know how i can implement this for multiple email addresses. Actually i have an array of email addresses that are separated with commas and i want that all of these should receive email reply. How i can implement this ? Your help will be much appreciated.

Upvotes: 12

Views: 12455

Answers (2)

gmslzr
gmslzr

Reputation: 1251

The RFC5322 says:

In either case, an optional reply-to field MAY also be included, which contains the field name "Reply-To" and a comma-separated list of one or more addresses.

So, all you need to do is implode that array of yours into a comma-separated list.

$emails = array ( "[email protected]", "[email protected]", "[email protected]");
$str = implode (",", $emails); //[email protected],[email protected],[email protected]
$headers .= "Reply-To: $str\r\n"

Upvotes: 26

さりげない告白
さりげない告白

Reputation: 1497

I've not done it with reply-to, but if it works the same as CC, then doing it like this should be possible.

$headers .= "Reply-To: [email protected],[email protected]\r\n"

Upvotes: 0

Related Questions