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/ –