【问题标题】:mailto: with multiple addresses and real namesmailto:有多个地址和真实姓名
【发布时间】:2014-04-01 09:57:55
【问题描述】:

我有后端管理工具,可以管理在不同部门工作的多个群体。有时我需要向一个组中的所有人发送电子邮件,因此我在我的管理工具中创建了一个按钮,该按钮执行一个简单的 mailto: 用于该部分中的所有用户。例如:

<a href="mailto:foo@bar.com, an@example.com, test@testing.com">Mail All</a>

这很好用。但是,我想将他们的真实姓名添加到 mailto 链接,这样当我发送邮件时,我可以快速查看群组中的人员。所以我尝试像这样格式化链接:

<a href="mailto:Foo%20Foo&lt;foo@bar.com&gt,Anne%20Example&lt;an@example.com&gt;,Mr%20Test&lt;test@testing.com&gt;">Mail All</a>

但这似乎只选择了第一个电子邮件地址并将“真实姓名”列为一个带逗号的长姓名。

在网上搜索,关于多个真实姓名地址的文档很少(仅在发送一个时才找到信息)。所以想知道这是否(a)不可能,(b)可能,但我的语法错误或c)只有当我使用一种解决方法(如将所有电子邮件地址数据复制到剪贴板并将其粘贴到邮件中)时才有可能.

那里有电子邮件专家吗?

【问题讨论】:

    标签: email mailto


    【解决方案1】:

    我也有同样的问题。我鬼鬼祟祟地使用 UTF-8 编码让它工作。

    "First Last" <firstlastname@example.com>
    

    变成

    <a href="mailto:%22First%20Last%22%20%3cfirstlastname@example.com%3e">Send Email</a>
    

    我还可以按照上面的示例添加一个包含多个地址的密件抄送字段,并用逗号分隔它们。

    通过将“mailto:”替换为“https://mail.google.com/mail/?view=cm&fs=1&tf=1&to=”在 Outlook 和 Gmail Compose 中启动

    【讨论】:

      【解决方案2】:

      我说“不可能”,至少是我解释RFC 6068的方式:

      The syntax of a 'mailto' URI is described using the ABNF of [STD68], 
      non-terminal definitions from [RFC5322] (dot-atom-text, quoted-   
      string), and non-terminal definitions from [STD66] (unreserved, pct-  
      encoded):
      
        mailtoURI    = "mailto:" [ to ] [ hfields ]
      **to           = addr-spec *("," addr-spec )
        hfields      = "?" hfield *( "&" hfield )
        hfield       = hfname "=" hfvalue
        hfname       = *qchar
        hfvalue      = *qchar
      **addr-spec    = local-part "@" domain
      **local-part   = dot-atom-text / quoted-string
        domain       = dot-atom-text / "[" *dtext-no-obs "]"
        dtext-no-obs = %d33-90 / ; Printable US-ASCII
                       %d94-126  ; characters not including
                                 ; "[", "]", or "\"
        qchar        = unreserved / pct-encoded / some-delims
        some-delims  = "!" / "$" / "'" / "(" / ")" / "*"
                     / "+" / "," / ";" / ":" / "@"
      

      (我用**标记了有趣的规则)

      具体来说:

      [RFC5322] 中指定的邮件地址,但不包括 from [RFC5322].

      您尝试使用的地址格式在 RFC5322 中称为 name-addraddr-spec 只是 name@domain 部分。

      【讨论】:

        猜你喜欢
        • 2014-12-18
        • 1970-01-01
        • 1970-01-01
        • 2020-04-26
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-04-21
        相关资源
        最近更新 更多