I recently wrote mailing list software in Ruby On Rails. I would like to get some expert advice on the best way to test it. For example, it would be cool if I could write a script generate 10,000 email addresses, use the software to send an email to those 10,000 addresses, and then write a script to make sure the emails got through. I am not sure how easy/possible this is.
as long as you own all 10,000 email addresses, you can do it
the simple solution is to set up an email service with a 'catch-all' email address, i.e. one that receives all incoming email to the same domain where the address does not exist. Then you can generate random nonsense for the recipient addresses but all on the same domain, and after they're sent you can collect them all from the catch-all account, strip out the list of intended recipient email addresses, and compare that to the list of generated recipients
it would be best if you did this on your own email server/system, though, to avoid getting blacklisted as a spammer!
If you happen to have an email address on a system run with the Postfix MTA, you have an arbitrarily large supply of email addresses at your disposal. For example, my regular email address is [email protected], but mail sent to [email protected] will get forwarded according to the contents of ~nr/.forward+xxx. I used this facility once when I need a collection of 120 distinct email addresses because I was acting as a trusted third party for anonymous communication between a bunch of other people.
In the default configuration for Postfix, the manual says
mail for name+foo is delivered to the alias name+foo or to the alias name, to the destinations listed in ~name/.forward+foo or in ~name/.forward, to the mailbox owned by the user name, or it is sent back as undeliverable.
I suppose your ML manager has a command interface, being either a web one or a mail one (or hopefully both)? You need to test these as well. Web UI is a bit more difficult to test but the mail one should be pretty simple. If I were to write such a ML manager, I'd probably add a XML-RPC/SOAP webservice to access admin functions. If your ML manager also support, grouping of mail by domain (all *@aol.com, and so on), it would be good to test this as well. In such matters, TDD approach would be nice to follow. Many functions in a MLM can be tested with unit tests.