【问题标题】:How to send a iCal invite with Mailgun Rest API coldfusion如何使用 Mailgun Rest API Coldfusion 发送 iCal 邀请
【发布时间】:2019-09-14 21:48:19
【问题描述】:

`我正在使用mailgun 在我的网站中设置邮件功能。我可以使用 mailgun API 发送邮件,包括文本和 HTML 内容。但是,我需要发送带有日历附件的邮件,但在 ColdFusion 中找不到更好的方法。谁能帮帮我?

<cfhttp result="result" method="POST" charset="utf-8"
   url="https://api.mailgun.net/v3/sandbox0000000000000000000.mailgun.org/messages" >

    <cfhttpparam type="header" name="Authorization" 
       value="Basic #ToBase64("api:***********************************79")#" />
    <cfhttpparam type="formfield" name="from" 
         value="postmaster@sandbox0000000000000000000.mailgun.org" >
    <cfhttpparam type="formfield" name="to" value="me@test.com"  />
    <cfhttpparam type="formfield" name="subject" value="mail content"  />
    <cfhttpparam type="formfield" name="text" value="mail content from test account"  />
    <cfhttpparam type="formfield" name="attachment" value="my path"  />
</cfhttp>

【问题讨论】:

  • 提示,CFML 等基于标签的代码必须缩进四个空格,否则将不可见。您也可以在编辑器中使用代码按钮{}

标签: coldfusion gmail icalendar mailgun coldfusion-10


【解决方案1】:

对于invite.ics 日历文件,我首先将此文件写入一个文件夹,因此我可以为名称attachment 提供cfhttpparam 的路径。发送邮件后,我刚刚从我的文件夹中删除了它。对于任何类型的文件,它都很简单。

<cfhttp result="result" url="https://api.mailgun.net/v3/sandbox0000000000000000000.mailgun.org/messages" method="POST">
    <cfhttpparam type="header" name="Authorization" value="Basic #ToBase64("api:***********************************79")#" />
    <cfhttpparam type="FORMFIELD" name="from" value="test@gmail.com">
    <cfhttpparam type="FORMFIELD" name="to" value="test@test.com">
    <cfhttpparam type="FORMFIELD" name="subject" value="attachment test">
    <cfhttpparam type="FORMFIELD" name="text" value="Hello">
    <cfhttpparam type="formfield" name="html" value="<html>Testing with text/calendar******* type</html>"  />
    <cfhttpparam type="file" name="attachment" file="#yourattachementfilepath here#" >
</cfhttp>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-06-04
    • 2013-06-09
    • 2021-07-21
    • 2020-12-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-01-05
    相关资源
    最近更新 更多