3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/blogpost/gmail.rb', line 3
def self.post(opts={})
opts = Blogpost.options.merge(opts)
options = { :address => "smtp.gmail.com",
:port => 587,
:domain => 'gmail.com',
:user_name => opts[:user],
:password => opts[:pass],
:authentication => 'plain',
:enable_starttls_auto => true }
Mail.defaults do
delivery_method :smtp, options
end
mail = Mail.new do
to opts[:address]
from opts[:user]
subject opts[:title]
body opts[:content]
content_type 'text/html; charset=UTF-8'
end
mail.deliver
end
|