Skip to content

Instantly share code, notes, and snippets.

@mdeering
Created December 15, 2011 07:57
Show Gist options
  • Save mdeering/1480278 to your computer and use it in GitHub Desktop.
Save mdeering/1480278 to your computer and use it in GitHub Desktop.
Initializer for adding the full name to the email address for SMTP
module ActionMailer
class Base
def perform_delivery_smtp(mail)
destinations = mail.destinations
mail.ready_to_send
sender = (mail['return-path'] && mail['return-path'].spec) || Array(mail.from).first
smtp = Net::SMTP.new(smtp_settings[:address], smtp_settings[:port])
smtp.enable_starttls_auto if smtp_settings[:enable_starttls_auto] && smtp.respond_to?(:enable_starttls_auto)
smtp.start(smtp_settings[:domain], smtp_settings[:user_name], smtp_settings[:password],
smtp_settings[:authentication]) do |smtp|
smtp.sendmail(mail.encoded, sender, destinations)
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment