37 lines
983 B
Ruby
37 lines
983 B
Ruby
require "mail"
|
|
|
|
class ReadingsMailer
|
|
OPTIONS = { :address => "mail.van-halteren.net",
|
|
:port => 465,
|
|
:domain => 'van-halteren.net',
|
|
:user_name => 'aart@van-halteren.net',
|
|
:password => '',
|
|
:authentication => 'plain',
|
|
:enable_ssl => true}
|
|
|
|
#
|
|
# Class methods
|
|
#
|
|
class << self
|
|
def deliver
|
|
|
|
mail = Mail.new do
|
|
#delivery_method :smtp, OPTIONS
|
|
to 'aart@van-halteren.net'
|
|
from 'SmartMeter <aart@van-halteren.net>'
|
|
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!
|
|
end
|
|
end
|
|
end |