【问题标题】:Why Devise change me the sender name?为什么要设计更改我的发件人姓名?
【发布时间】:2018-06-14 16:50:18
【问题描述】:

我创建了一个 google 帐户和一个 Gmail 帐户(例如我们认为:mytest@gmail.com),以便通过我的应用程序发送电子邮件。帐户设置具有发件人名称“MyTest”,如果我尝试正常发送消息,收件人的邮箱会显示来自“MyTest”(发件人名称)的消息。但是,如果我通过我的应用程序发送一封电子邮件,其中我使用此帐户通过 smtp 访问 gmail,收件人的邮箱会显示来自“mytest@gmail.com”的消息......这怎么可能?

config/initializers/devise.rb

config.mailer_sender = 'MyTest'

config/environments/development.rb

config.action_mailer.perform_deliveries = true
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.default_url_options = { host: 'localhost:3000' }
  config.action_mailer.smtp_settings = {
    user_name:      'mytest@gmail.com',
    password:       'passwordtest',
    domain:         'localhost:3000',
    address:       'smtp.gmail.com',
    port:          '587',
    authentication: :plain,
    enable_starttls_auto: true
}

【问题讨论】:

    标签: ruby-on-rails devise gmail ruby-on-rails-5 actionmailer


    【解决方案1】:

    是格式的问题,需要在设计初始化器中这样添加

    config.mailer_sender = '"MyTest" <mytest@gmail.com>'
    

    【讨论】:

      猜你喜欢
      • 2013-01-14
      • 1970-01-01
      • 2020-07-06
      • 1970-01-01
      • 1970-01-01
      • 2012-03-31
      • 2012-12-07
      • 1970-01-01
      • 2019-09-05
      相关资源
      最近更新 更多