Created
July 13, 2011 18:21
-
-
Save tomasv/1080938 to your computer and use it in GitHub Desktop.
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' | |
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 | |
size = numbers.size | |
numbers.each_with_index do |number, index| | |
Mail.deliver do | |
from "[email protected]" | |
to "[email protected]" | |
subject number | |
body body_text | |
add_file attachment | |
end | |
puts "#{number} sent. #{index.succ}/#{size}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment