email - 如何在 CF9 中使用 cfscript 发送带有附件的电子邮件?

标签 email coldfusion coldfusion-9 cfmail

您如何使用 cfscript 执行以下操作?

<cfmail
   from="me@domain.com"
   to="you@domain.com"
   subject="Attachments">
   <cfmailparam name="Reply-To" value="me@domain.com">
   Some message goes here...
   <cfmailparam file="c:\files\readme.txt">
   <cfmailparam file="c:\files\logo.gif">
</cfmail>

使用以下会导致“函数声明中缺少函数关键字”错误:
mail subject="Test Email" from="me@domain.com to="you@domain.com" server="localhost" {
    mailpart file="#ExpandPath('readme.txt')#";
}

最佳答案

以下是解释需要做什么的操作说明:http://simonbingham.posterous.com/sending-email-using-cfscript-in-coldfusion-9

// Create an instance of the mail object
mail=new mail();

// Set it's properties
mail.setSubject( "Sample Email" );
mail.setTo( "to@example.com" );
mail.setFrom( "from@example.com" );
mail.setCC( "cc@example.com" );
mail.setBCC( "bcc@example.com" );

// Add an attachment
mail.addParam( file="C:\foo.txt" );

// Add email body content in text and HTML formats
mail.addPart( type="text", charset="utf-8", wraptext="72", body="This is a test message." );
mail.addPart( type="html", charset="utf-8", body="<p>This is a test message.</p>" );

// Send the email
mail.send();

关于email - 如何在 CF9 中使用 cfscript 发送带有附件的电子邮件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8423276/

相关文章:

php - 如何在 Laravel 5.5 中发送多封邮件

sql-server - 在 Coldfusion 构建器中连接到 SQL 数据库

sql - 如何在 sql 查询中创建空白/硬编码列?

postgresql - 将大数据导出到 CSV 文件

oauth - 如何在 ColdFusion 9 中签署 Quickbooks 在线 API 请求?

python - 是否有自定义 Django 电子邮件确认链接模块?

带有多个嵌入图像的 VB.NET 电子邮件

html - 样式化 HTML 电子邮件

jquery - 需要帮助使用 ColdFusion 和 jsTree 复制目录结构

coldfusion - Railo、Open Bluedragon 和 Adob​​e Coldfusion 之间有哪些显着差异?