How can I send mail with rails without a template?

The simplest way to send mail in rails 3 without a template is to call the mail method of ActionMailer::Base directly followed by the deliver method,

For ex, the following would send a 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 you all the header options and also ideas about the how to send a multipart/alternative email with text/plain and text/html parts directly.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)