How can I send mail with rails without a template?

后端 未结 4 1874
旧巷少年郎
旧巷少年郎 2021-02-01 01:29

In my Rails 3 project, I want to send some simple notification emails. I don\'t need to make a template for them or do any logic. I just want to fire them off from various place

4条回答
  •  梦谈多话
    2021-02-01 02:08

    You can try something like this:

    class Notifier < ActionMailer::Base
      def send_simple_message(options)
        mail(options.except(:body)) do |format|
          format.text { render :text => options[:body] }
        end.deliver
      end
    end
    

提交回复
热议问题