Sha256: d063b97a0ffc721580c66416e887fe8f94c05399d42e373082291b619b3fed60
Contents?: true
Size: 1.06 KB
Versions: 9
Compression:
Stored size: 1.06 KB
Contents
class UserMailer < ActionMailer::Base default_url_options = {:host => 'example.com'} def signup(email, name) @recipients = email @from = "admin@example.com" @subject = "Account confirmation" @sent_on = Time.now @body[:name] = name end def newsletter(email, name) @recipients = email @from = "admin@example.com" @subject = "Newsletter sent" @sent_on = Time.now @body[:name] = name end def attachments(email, name) @recipients = email @from = "admin@example.com" @subject = "Attachments test" @sent_on = Time.now @body[:name] = name add_attachment 'image.png' add_attachment 'document.pdf' end private def add_attachment(attachment_name) content_type 'multipart/mixed' attachment_path = File.join(RAILS_ROOT, 'attachments', attachment_name) File.open(attachment_path) do |file| filename = File.basename(file.path) attachment :filename => filename, :content_type => File.mime_type?(file), :body => file.read end end end
Version data entries
9 entries across 9 versions & 4 rubygems