Some months ago I attended a Symantec Mail Security training course (a kickass system, btw). They had this little graphical testing utility which accepted an SMTP server address, from field, etc and a list of .eml files and the number of copies to send.
I thought this was a brilliant tool and was pretty surprised to not find an equivalent on the Mac. However, OS X being Unix, it took about 30 minutes to write one myself, this time in Ruby:
./mailspray.rb smtp.example.com 25 email@example.com firstname.lastname@example.org 10 TestMail/
10 is the copies to send, TestMail is the name of the folder containing the .eml files. This requires the net/smtp gem being installed, but IIRC it comes with Leopard by default.
I think using .eml files is really powerful since you can test it with all manner of encodings, headers, attachments (including viruses) and spam.
The name comes from the instructor who referred to sending test mails as “spraying the server with mail”. :)
The script in it’s entirety:
require 'net/smtp' if ARGV.length < 6 puts "Usage: mailspray.rb server port from to copies directory" Process.exit end server, port, from, to, copies, directory = ARGV Dir.glob(directory + "/*.eml") do |f| puts "Sending " + copies + " copies of " + File.basename(f) msgstr = "" File.open(f, "r") do |l| msgstr = l.read end Net::SMTP.start(server, port) do |smtp| copies.to_i.times do |i| smtp.send_message msgstr, from, to end end end