Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: Capturing Email During Testingby mcdave (Beadle) |
on Jan 31, 2012 at 17:21 UTC ( [id://951021]=note: print w/replies, xml ) | Need Help?? |
About a different method for capturing email in a test framework... I've had great success (and fun) with "fakemail" http://www.lastcraft.com/fakemail.php. It sets up an SMTP server on localhost and anything that gets "mailed" to it ends up in a separate file in a directory of your choosing.
I just have the following two line in my code and I toggle the comment depending on whether I'm testing or not: If you can't toggle the comments, you can change the network. Add an entry in /etc/hosts (or whatever your equivalent is) so "real.smtp.server.net" resolves to localhost and use fakemail running on port 25. Although that might just confirm: "There's more than one way to do it" doesn't always mean there's more than one way you should do it.
In Section
Seekers of Perl Wisdom
|
|