问题
I am using mailto link to populate bcc of users default email program.
$mem_email=" ";
$sql="SELECT email_address FROM employee";
$contacts = $db->query($sql);
while($contact = $db->fetchByAssoc($contacts))
{
if($contact['email_address']!="" && $contact['email_address']!=NULL)
{
$mem_email.=$contact['email_address'].", ";
}
}
header("Location: mailto:?bcc={$mem_email}");
My question is what is the best separator to separate multiple emails in bcc field , or ; .
In my case i am using ', '.
回答1:
The separator should be a comma (,
) and there should not be a space.
See RFC 6068.
回答2:
Here's a late caveat in case anybody needs it:
Even though RFC explicitly recommends a comma, Microsoft Outlook will use the "list separator character" defined in the regional settings. Your mailto links may not work correctly for your Windows + Outlook users whose systems are configured with a different list separator such as semicolons. Outlook will simply refuse to split the e-mail addresses with commas.
Just something to keep in mind.
回答3:
Use following code,
implode(',', $contacts);
above code will give comma separated emails.
来源:https://stackoverflow.com/questions/12120190/what-is-the-best-separator-to-separate-multiple-emails