Action Mailer 发邮件
核心是 gem 'mail'
require 'mail'
Mail.defaults do
delivery_method :smtp,
:address => "smtp.gmail.com",
:port => 587,
:domain => "example.com",
:authentication => :plain,
:user_name => "<gmail_username>@gmail.com",
:password => "<gmail_password>",
:enable_starttls_auto => true
end
mail = Mail.new do
from 'from@example.com'
to 'to@example.org'
subject 'First multipart email sent with Mail'
text_part do
body 'This is plain text'
end
html_part do
content_type 'text/html; charset=UTF-8'
body '<h1>This is HTML</h1>'
end
end
mail.deliver!引入其它,为了更好用
引入其它,为了更实用
实现方式:汝果欲学诗, 功夫在诗外
最后更新于