Rails:如何发送text.erb或html.erb电子邮件

时间:2018-07-04 16:25:48

标签: ruby-on-rails

我在邮件收发器中使用以下方法发送text.erb或html.erb电子邮件。

 def new_notification(new)
    @new = new
    attachments.inline["logo.png"] = File.read("#{Rails.root}/app/assets/images/logo.png")
    mail(to: @new.email, subject: "Welcome") do |format|
      format.text
      # or
      format.html
    end
 end    

如何使用以下方法进行相同操作?这是另一个邮件程序中的设计方法。

def email_changed(record, opts={})
  attachments.inline["logo.png"] = File.read("#{Rails.root}/app/assets/images/logo.png")
  headers["Custom-header"] = "Bar"
  opts[:from] = 'admin@pinsle.com'
  opts[:reply_to] = 'no reply'
  super
end

0 个答案:

没有答案