Skip to content

Instantly share code, notes, and snippets.

@sunny
Created December 17, 2014 10:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sunny/3c2c7b23285fbc5c5257 to your computer and use it in GitHub Desktop.
Save sunny/3c2c7b23285fbc5c5257 to your computer and use it in GitHub Desktop.
Application Mailer helper
# lib/email_with_name.rb
module EmailWithName
def email_with_name(email, name)
name = name.gsub(/"<>/, '')
"#{name} <#{email}>"
end
end
# app/mailers/application_mailer.rb
class ApplicationMailer < ActionMailer::Base
include EmailWithName
extend EmailWithName
default from: email_with_name("hello@cults3d.com", "Cults.")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment