【问题标题】:Amazon SES: How to send HTML mail to all usersAmazon SES:如何向所有用户发送 HTML 邮件
【发布时间】:2019-06-15 07:05:31
【问题描述】:

我想在 rails 应用程序上发送所有用户 (

所以我编码如下:

class NewsMailer < ApplicationMailer
  def all_notify(news)
    @news = news
    @users = User.where(is_news: true)

    @users.each do |user|
      mail(
        subject: @news.title,
        to: user.email,
      )
    end
  end
end

虽然email已经发送,但是html是这样折叠的。

当我尝试发送给一位用户时。它不会出现问题。但是当使用each 会导致问题...

你有什么想法吗?

【问题讨论】:

    标签: ruby-on-rails amazon-ses


    【解决方案1】:
      @users.each do |user|
        NewsMailer.all_notify(@news, user).deliver
      end
    

    我可以通过在控制器上写each 来做到这一点。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-12
      • 1970-01-01
      • 2017-08-03
      • 1970-01-01
      相关资源
      最近更新 更多