英文:
incoming email addresses - some have double contents and backslashes?
问题
我不确定如何为此命名 - 在我们的应用程序中,我们可以接收电子邮件,并解析to
电子邮件地址。
我们将地址记录如下:functions.logger.info('解析电子邮件地址:%j',addr);
大多数电子邮件都以字符串形式出现,如下所示:
"解析电子邮件地址:"example_12345@mail.exampleapp.com""
但今天我们开始收到这样的地址:
"解析电子邮件地址:"\example_78910@mail.exampleapp.com\" <example_78910@mail.exampleapp.com>"
有人见过这种情况吗?这似乎是邮件客户端在将数据发送给我们之前以不寻常的方式格式化数据。有人能提供一些关于这里发生了什么或邮件客户端可能是罪魁祸首的指示吗(如果真的是这样的话)?
谢谢!
英文:
I'm not even sure how to title this - in our app we can receive emails, and we are parsing the to
email address.
we are logging the address like this functions.logger.info('Parsing email address: %j', addr);
most of the emails come in as a string, like this:
"Parsing email address: "example_12345@mail.exampleapp.com""
but today we started some receiving addresses like this:
Parsing email address: "\"example_78910@mail.exampleapp.com\" <example_78910@mail.exampleapp.com>"
Has anyone seen this before? It's as if the mail client is formatting the data in an unusual way before sending it to us. Can anyone give some pointers on what's happening here, or what mail client might be the culprit (if that's even the case)?
Thanks!
答案1
得分: 1
这符合RFC 5322的规范要求。通常,一个邮箱由两部分组成:(1)可选的显示名称,指示收件人的姓名(可以是个人或系统),可能会显示在邮件应用程序的用户面前;(2)带有尖括号(“<”和“>”)括起来的 addr-spec 地址。也有一种简化形式的邮箱,其中 addr-spec 地址单独出现,不带收件人的姓名或尖括号。Internet addr-spec 地址在第3.4.1节中有描述。
还提到了一些你可能需要处理的 To:
头部的其他常见格式。
英文:
That's within the spec of [RFC 5322]
(https://datatracker.ietf.org/doc/html/rfc5322#section-3.4)
> Normally, a mailbox is composed of two parts: (1) an optional display
name that indicates the name of the recipient (which can be a person
or a system) that could be displayed to the user of a mail
application, and (2) an addr-spec address enclosed in angle brackets("<" and ">"). There is an alternate simple form of a mailbox where
the addr-spec address appears alone, without the recipient's name or
the angle brackets. The Internet addr-spec address is described in
section 3.4.1.
It goes on to mention some other common formats for the To:
header you might want to handle.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论