what is the best separator to separate multiple emails

别说谁变了你拦得住时间么 提交于 2019-12-30 03:41:41

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!