Created
July 25, 2012 20:07
-
-
Save mars/3178259 to your computer and use it in GitHub Desktop.
Bulk email via gmail
This file contains 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
require "rubygems" | |
# gem install ruby-gmail | |
require 'gmail' | |
# gather email list | |
addresses = %w{ | |
email1@domain.com | |
email2@domain.com | |
email3@domain.com | |
} | |
# compose email | |
message_subject = "You are the sunshine of my life." | |
message_body = <<EOF | |
That's why I'll always be around. | |
Yours 4 ever, | |
Stevie | |
EOF | |
# send email | |
Gmail.new('your.email@domain.com', 'password') do |gmail| | |
addresses.each do |e| | |
gmail.deliver do | |
to e | |
subject message_subject | |
text_part do | |
body message_body | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment