0
我有一个动作邮件的方法是这样的:的ActionMailer作用的生产服务器上的不同
def mail
@receiver = User.where(status: 2).pluck(:email)
mail(bcc:@receiver, to: "[email protected]")
end
application.yml看起来是这样的:
SMTP_ADDRESS: 'smtp.gmail.com'
SMTP_PORT: 587
SMTP_HOST: 'localhost:3000'
SMTP_DOMAIN: 'localhost:3000'
SMTP_USERNAME: '[email protected]'
SMTP_PASSWORD: 'xxxxx'
SUPER_ADMIN_EMAIL: '[email protected]'
developmet.rb样子此:
config.action_mailer.asset_host = ENV["SMTP_HOST"]
# config.action_mailer.delivery_method = :letter_opener
config.action_mailer.raise_delivery_errors = false
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
#Enter the smtp provider here ex: smtp.mandrillapp.com
address: ENV["SMTP_ADDRESS"],
port: ENV['SMTP_PORT'].to_i,
#Enter the smtp domain here ex: vendaxo.com
domain: ENV["SMTP_DOMAIN"],
#Enter the user name for smtp provider here
user_name: ENV["SMTP_USERNAME"],
#Enter the password for smtp provider here
password: ENV["SMTP_PASSWORD"],
authentication: 'plain',
enable_starttls_auto: true
收件人保存在BCC中,但“[email protected]”将能够看到BCCd接收者。当我从本地主机发送邮件时,这工作正常。当收件人发送电子邮件时,所有人都在密件抄送中,一个“[email protected]”能够看到所有的收件人。
但是当我做生产服务器具有相似application.yml配置更改主机和端口[email protected]没有得到BCCD接收的电子邮件,同样的事情。
可能会有所帮助https://www.sitepoint.com/deliver-the-mail-with-amazon-ses-and-rails/ –