ruby - How can I send mail with rails without a template? -
in rails 3 project, want send simple notification emails. don't need make template them or logic. want fire them off various places in system.
if doing in arbitrary ruby script use pony. however, i'd still use rails mail facilities , configuration, same reliability , setup have rest of mail in system.
what's simple way this? ideally there method
actionmailer.send(:to => 'foo@example.com', :subject =>"the subject", :body =>"this body")
the simplest way send mail in rails 3 without template call mail
method of actionmailer::base
directly followed deliver
method,
for ex, following send plain text e-mail:
actionmailer::base.mail(from: "me@example.com", to: "you@example.com", subject: "test", body: "test").deliver
http://api.rubyonrails.org/classes/actionmailer/base.html#method-i-mail gives header options , ideas how send multipart/alternative email text/plain , text/html parts directly.
Comments
Post a Comment