coldfusion - this.smtpServersettings 正在将邮件发送到未送达的选项而不是 gmail

标签 coldfusion cfmail coldfusion-2018

我想通过真实的 Gmail ID 向最终用户发送一封电子邮件。因此,我使用 smtp.gmail.com 作为邮件服务器,并使用自己的电子邮件用户名和密码。但如果我在 application.cfc 中使用 this.smtpServersettings ,它就不会发送电子邮件。所有邮件都转到未送达选项。我的示例代码, App.cfc:

<cfset this.name='mailfn8'>
<cfset this.smtpServersettings={server:"smtp.gmail.com",username:"mygmail@gmail.com",password:"mypassword"}>

My.cfm:

<cfmail from='sender@gmail.com' to='receiver@gmail.com' subject='test' type='html' port="587" usetls="true">
    I'm seding a email by using this.smtpServersettings options.
</cfmail>

但是凭证在以下情况下效果很好,

-- If I set my details in application scope and use that values in cfmail tag
-- Directly set it in coldfusion mail server setting

例如, App.cfc:

<cfset this.name='mailfn8'>
<cffunction name='onApplicationStart'>

    <cfset application.server='smtp.gmail.com'>
    <cfset application.username='mygmail@gmail.com'>
    <cfset application.password='mypassword'>

</cffunction>

My.cfm:

<cfmail from='sender@gmail.com' to='receiver@gmail.com' server= '#application.server#' username='#application.userName#' password='#application.password#' subject='test' type='html' port="587" usetls="true">
    I'm seding a email by using application scope.
</cfmail>

以上工作正常。 那么为什么 this.smtpServersettings 是将电子邮件发送到未送达选项而不是 gmail。 ?。如果我使用 this.smtpServerSetting ,是否需要启用任何其他设置?请帮我解决这个问题。如果我理解有任何错误,请纠正我。谢谢!.

最佳答案

smtpServerSettings 结构不支持端口和 usetls。

https://tracker.adobe.com/#/view/CF-4204467

我的建议是在应用程序范围内创建您自己的结构,然后传递给带有 argumentCollection 属性的 cfmail 标记。

关于coldfusion - this.smtpServersettings 正在将邮件发送到未送达的选项而不是 gmail,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60462950/

相关文章:

javascript - ColdFusion - 检测顶部窗口

coldfusion - CFML2WDDX 错误 ColdFusion 11

coldfusion - CFMail 返回表格

coldfusion - <cfmail> 输入和电子邮件之间的延迟以及电子邮件发送的时间

java - ColdFusion 邮件假脱机超时

jquery - 对带有 URL 的数据属性进行 EncodeFor

javascript - 如何使用 URLDecode 之类的东西取回 html 格式的文本

php - 在 PHP 中取消加密/重新加密 ColdFusion 加密的字符串

coldfusion - 在 QoQ 中使用求和函数时出现意外错误

coldfusion - CF WKHTMLTOPDF 将页面大小设置为信封