Skip to content

Instantly share code, notes, and snippets.

@mars
Created July 25, 2012 20:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mars/3178259 to your computer and use it in GitHub Desktop.
Save mars/3178259 to your computer and use it in GitHub Desktop.
Bulk email via gmail
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