用PHP解析电子邮件地址? [英] Parse e-mail addresses with PHP?
本文介绍了用PHP解析电子邮件地址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
与此问题类似,我如何解析电子邮件地址以这种格式,
Similar to this question, how could I parse e-mail addresses which are in this format,
"Bob Smith" <bob@company.com>, joe@company.com, "John Doe"<john@company.com>
得到如下结果:
array(
'bob@company.com'=>'Bob Smith'
'joe@company.com'=>''
'john@company.com'=>'John Doe'
);
推荐答案
嗯,你可以使用 mailparse_rfc822_parse_addresses()
,这正是这样。这是一个PECL扩展名,所以可能会更容易使用 评论中提到的Mail_RFC822 :: parseAddressList()
。
Well, you could use mailparse_rfc822_parse_addresses()
, which does exactly that. It's a PECL extension, so it might be easier to use Mail_RFC822::parseAddressList()
as mentioned in the comments.
这篇关于用PHP解析电子邮件地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文