I agree with you completely on Net::SMTP,
merlyn. However,
gaggio posted a module that has some additional functionality that Net::SMTP doesn't directly support.
All this depends on where you're counting on the SMTP server being located, however. If you're using the local machines, which is the wisest, then this argument holds no water. You can always count on being able to connect to the local SMTP server (as a general rule. Always check return results to be sure!). Additionally, a user may be getting his mail via POP3 or IMAP, because s/he may not have a local SMTP server that you can connect to.
If you're trying to connect to a SMTP mailserver on a remote network, then unless you know the actual address of the SMTP server, you may not be able to connect to it. The remote network may have an MX record for their SMTP server, since the mail machine may be mail.mynetwork.com, but has a different IP address than user@mynetwork.com.
To this end,
gaggios module uses DNS::Resolver to determine if an MX record exists for that network, and sends mail to the appropriate MX machine.
I think this idea is really good, although (and no offense,
gaggio) I'd really like to see it wrapped around Net::SMTP, instead of code that has had less exposuse to real world server issues.
--Chris
e-mail jcwren