Skip to content

Instantly share code, notes, and snippets.

@tomasv
Created July 13, 2011 18:18
Show Gist options
  • Save tomasv/1080929 to your computer and use it in GitHub Desktop.
Save tomasv/1080929 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'mail'
Mail.defaults do
delivery_method :smtp, { :address => "smtp.gmail.com",
:port => 587,
:domain => 'varneckas.lt',
:user_name => '[email protected]',
:password => '',
:authentication => 'plain',
:enable_starttls_auto => true }
end
numbers = File.read("numbers.txt").split("\n")
body_text = File.read("body.txt")
attachment = File.open("attachment").path
numbers.each do |number|
Mail.deliver do
from "[email protected]"
to "[email protected]"
subject number
body body_text
add_file attachment
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment