I need to know how to separate receivers of an email in a $to variable.
I have written:
$to = "email@aaa.com.au";"email2@aaa.com.au"
and it only goes to the first email address - how should I write it?
Thanks in advance for your help - this is driving me insane
Can anyone help?
Moderator: General Moderators
Re: Can anyone help?
Seperate them via comma's instead of semi-colons. for example:suey wrote:I need to know how to separate receivers of an email in a $to variable.
I have written:
$to = "email@aaa.com.au";"email2@aaa.com.au"
and it only goes to the first email address - how should I write it?
Thanks in advance for your help - this is driving me insane
Code: Select all
$to = "email1@domain.com, email2@domain.com";Code: Select all
$Emails = "email1@domain.com, email2@domain.com";
// Split emails into an array
$ToArray = explode(",",$Emails);
// 1 loop for each email address
foreach($ToArray as $To) {
// Send mail, $To variable contains the current email address.
}
Re: Can anyone help?
Thanks, I've tried it out and it works. You're a saviour!!