mail results
This commit is contained in:
37
app/helpers/ReadingsMailer.rb
Normal file
37
app/helpers/ReadingsMailer.rb
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
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
|
||||||
Reference in New Issue
Block a user