in reply to Checking mail command for success

How are you deploying the changes to your program wrapping the mail command? Perhaps you're using ftp, sftp, scp, rsync, or something similar? Chances are any of the pure-Perl mail sending modules could be deployed the same way.

Some of those mail sending modules even just wrap a Sendmail mail submission executable (or the mock sendmail executables offered for compatibility by any of Postfix, Exim, qmail, SMail, or a long list of others) usually found at /usr/sbin/sendmail, /usr/bin/sendmail, or (for hysterical porpoises) /usr/lib/sendmail. The trick is, they wrap it properly so you don't have to. They let you just call a simple sub from your Perl program so you don't have to sweat the details.

If you really want to wrap an external program, consider a module that does so. If you can't stand the thought of a module, consider grabbing the code from one and crediting the author. That would let you just update the one file on those servers instead of two.

I generally use my own interface module around Net::SMTP::TLS and have hacked support for that module into NMS formmail, too. However, you might prefer Mail::Mailer, Mail::Sendmail, MIME::Lite, or Mail::DWIM (which is one of those that will wrap around a Sendmail mail submission executable).

Update: fixed a typo in PM link tag for Mail::DWIM