Created
June 27, 2012 22:02
-
-
Save samflores/3007147 to your computer and use it in GitHub Desktop.
Enviar e-mail
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'mail' | |
Mail.defaults do | |
delivery_method :smtp, { | |
:address => '<smtp server>', | |
:port => 587, | |
:user_name => '<username>', | |
:password => '<password>', | |
:authentication => 'plain', | |
:enable_starttls_auto => true } | |
end | |
mail = Mail.new do | |
from '<from mail address>' | |
to '<to mail address>' | |
subject '<subject>' | |
body '<message>' | |
end | |
mail.deliver! |
Realmente, é assim:
require 'mail'
options = { :address => "smtp.gmail.com",
:port => 587,
:domain => 'your.host.name',
:user_name => '<username>',
:password => '<password>',
:authentication => 'plain',
:enable_starttls_auto => true }
Mail.defaults do
delivery_method :smtp, options
end
Passa o bloco e o hash vem nos options.
foi assim que eu fiz, só não criei a variável options :p
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Agora eu que to em duvida. Tô procurando na documentação.