【问题标题】:Integrating SendGrid’s SMTP API with CFMAIL将 SendGrid 的 SMTP API 与 CFMAIL 集成
【发布时间】:2013-11-06 22:04:34
【问题描述】:

我正在使用 SendGrid’s SMTP API(不是 WEB API)并且正在考虑使用 cfmail 发送电子邮件。如果我使用cfmail 发送电子邮件,并且想在某处使用X-SMTPAPI 标头,您认为cfmail 是一个这样做的地方吗?请澄清。

【问题讨论】:

    标签: coldfusion coldfusion-9 sendgrid cfmail


    【解决方案1】:

    您可以通过使用cfmailparam 标记添加自定义标头来做到这一点。因此:

    <cfmailparam  
        name="X-SMTPAPI" 
        value="{\"category\":\"Cool Emails\"}">
    

    cfmail 标签的上下文中,它将如下所示。

    <cfmail 
        from="you@example.com" 
        to="nick@sendgrid.com" 
        subject="I am using CF Mail to do this!"> 
    <cfmailparam  
        name="X-SMTPAPI" 
        value="{\"category\":\"Cool Emails\"}">
    
    Look at my awesome use of cfmail!
    </cfmail>
    

    More can be found in the Adobe Documentation

    【讨论】:

    • 谢谢。无论如何,您知道我需要在哪里提及此处提到的以下更改:1)将您的 SMTP 用户名和密码更改为您的 SendGrid 凭据 2)将服务器主机名设置为 smtp.sendgrid.net 3)将端口 25 或 587 用于普通/TLS 连接和用于 SSL 连接的端口 465 sendgrid.com/docs/Integrate/index.html Coldfusion 服务器?因为我正在使用它?
    • 如果您希望通过 CF 发送的每封电子邮件都通过 Sendgrid 的服务器,您可以在 CF Admin(服务器设置 > 邮件)中进行设置。否则,cfmail 支持通过 serverusernamepasswordport 属性 (cfdocs.org/cfmail) 指定服务器、用户名/密码和端口。
    【解决方案2】:

    这对我有用。 上述建议引发了错误。

    <cfmailparam  
        name="X-SMTPAPI" 
        value='{"category":["Cool Emails"]}'>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-03-10
      • 1970-01-01
      • 2012-09-02
      • 1970-01-01
      • 2012-11-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多