Email attachments

前端 未结 3 995
后悔当初
后悔当初 2021-01-12 00:28

I want to be able to attach a file that I generate (on the fly, I dont want to save the file on my server) and send it out via email.

I have the text all done, but I

3条回答
  •  一个人的身影
    2021-01-12 01:27

    See http://railscasts.com/episodes/206-action-mailer-in-rails-3

    def registration_confirmation(user)
      @user = user
      attachments["rails.png"] = File.read("#{Rails.root}/public/images/rails.png")
      mail(:to => "#{user.name} <#{user.email}>", :subject => "Registered")
    end
    

提交回复
热议问题