Last active
November 6, 2018 06:46
-
-
Save albertico/2644a0c6e3ee70e64fe66f9bee58bab7 to your computer and use it in GitHub Desktop.
SMTP Examples for Amazon SES and WorkMail
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'mail' | |
Mail.defaults do | |
delivery_method :smtp, { :address => "email-smtp.us-east-1.amazonaws.com", | |
:port => 587, | |
:user_name => "YOUR_IAM_SMTP_USER_FOR_SES", | |
:password => "YOUR_VERY_LONG_PASSWORD", | |
:authentication => 'plain', | |
:enable_starttls_auto => true } | |
end | |
mail = Mail.deliver do | |
from '[email protected]' | |
to '[email protected]' | |
subject 'Hello from Amazon SES' | |
text_part do | |
body "This message has been sent through Amazon SES." | |
end | |
html_part do | |
content_type 'text/html; charset=UTF-8' | |
body "<p>This message has been sent through Amazon <strong>SES</strong>.</p>" | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'mail' | |
Mail.defaults do | |
delivery_method :smtp, { :address => "smtp.mail.us-east-1.awsapps.com", | |
:port => 465, | |
:user_name => "[email protected]", | |
:password => "YOUR_VERY_LONG_PASSWORD", | |
:authentication => 'login', | |
:ssl => true, | |
:enable_starttls_auto => false } | |
end | |
mail = Mail.deliver do | |
from '[email protected]' | |
to '[email protected]' | |
subject 'Hello from Amazon WorkMail' | |
text_part do | |
body "This message has been sent through Amazon WorkMail." | |
end | |
html_part do | |
content_type 'text/html; charset=UTF-8' | |
body "<p>This message has been sent through Amazon <strong>WorkMail</strong>.</p>" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment