gpt4 book ai didi

ruby-on-rails - ArgumentError : An SMTP To address is required to send a message. 设置消息 smtp_envelope_to、to、cc 或 bcc 地址

转载 作者:行者123 更新时间:2023-12-03 10:57:46 24 4
gpt4 key购买 nike

我得到了一个带有以下邮件程序配置的 rails 4 应用程序:

config.action_mailer.delivery_method = :smtp
config.action_mailer.default_url_options = { host: 'myhost.com' }
config.action_mailer.perform_deliveries = true

config.action_mailer.smtp_settings = {
:enable_starttls_auto => true,
:address => 'smtp.myhost.com',
:port => 587,
:domain => 'myhost.com',
:authentication => :login,
:enable_starttls_auto => false,
:tls => false,
:openssl_verify_mode => 'none',
:ssl => false,
:user_name => "myusername",
:password => "mypassword"
}

每次我尝试发送带有测试邮件程序设置的邮件时:
class TestMailer < ActionMailer::Base

default :from => "noreply@myhost.com"

def welcome_email
mail(:to => "testmail@mymailaddress.com", :subject => "Test mail", :body => "Test mail body")
end
end

TestMailer.welcome_email.deliver

我得到了这个异常(exception):

ArgumentError: An SMTP To address is required to send a message. Set the message smtp_envelope_to, to , cc, or bcc address.



有没有可能我忘记了要设置的东西。?
而且我找不到“smtp_envelope_to”的配置选项

最佳答案

错误消息不是关于 SMTP 信封,而是关于发件人:

An SMTP To address is required to send a message



其余的只是一个通用的信息。
你的东西 testmail@mymailaddress.com不管用。
您使用真实的工作地址吗?如果没有,请尝试一个。

关于ruby-on-rails - ArgumentError : An SMTP To address is required to send a message. 设置消息 smtp_envelope_to、to、cc 或 bcc 地址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18419611/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com