php 什么是分隔多封电子邮件的最佳分隔符

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12120190/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 02:52:06  来源:igfitidea点击:

what is the best separator to separate multiple emails

phpemailbcc

提问by Mansoor Jafar

I am using mailto link to populate bcc of users default email program.

我正在使用 mailto 链接来填充用户默认电子邮件程序的密件抄送。

$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 ; .

我的问题是在 bcc 字段中分隔多封电子邮件的最佳分隔符是什么,或者;.

In my case i am using ', '.

就我而言,我使用的是“,”。

回答by Alnitak

The separator should be a comma (,) and there should not be a space.

分隔符应为逗号 ( ,) 且不应有空格。

See RFC 6068.

请参阅RFC 6068

回答by Ishmaeel

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.

即使 RFC 明确推荐使用逗号,Microsoft Outlook 也会使用区域设置中定义的“列表分隔符”。对于系统配置了不同列表分隔符(如分号)的 Windows + Outlook 用户,您的 mailto 链接可能无法正常工作。Outlook 只会拒绝用逗号分隔电子邮件地址。

Just something to keep in mind.

只是要记住一些事情。

回答by Amar Gharat

Use following code,

使用以下代码,

implode(',', $contacts);

above code will give comma separated emails.

上面的代码将给出逗号分隔的电子邮件。