Skip to content

Instantly share code, notes, and snippets.

@mars mars/bulk_email.rb
Created Jul 25, 2012

Embed
What would you like to do?
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
You can’t perform that action at this time.