-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathJangoSMTP.rb
More file actions
39 lines (31 loc) · 1.2 KB
/
JangoSMTP.rb
File metadata and controls
39 lines (31 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
=begin
JangoSMTP.rb
This file demonstrates sending an email from a Ruby program using JangoSMTP.
This file requires the mail gem, which can be obtained at https://github.com/mikel/mail
The mail gem can be installed with the command 'gem install mail'
=end
require 'mail'
Mail.defaults do
delivery_method :smtp, { :address => "relay.jangosmtp.net",
:port => 25,
:domain => "YourDomain.com",
:user_name => "Your Username",
:password => "Your Password",
:authentication => 'plain',
:enable_starttls_auto => true }
end
# Set up your email
# Note that the from address must be stored in your list of from addresses
# To modify your from addresses, see Settings > Advanced > From Addresses
mail = Mail.deliver do
to 'To@EmailAddress.com'
from 'From Name <FromAddress@YourDomain.com>'
subject 'This is the subject!'
text_part do
body 'This plain text email was sent from a Ruby application!'
end
html_part do
content_type 'text/html; charset=UTF-8'
body '<b>This HTML email was sent from a Ruby application!</b>'
end
end