jjhorner has asked for the wisdom of the Perl Monks concerning the following question:

I'm looking for a good SMTP module that I can use to send mail via a script (for reporting logfile analysis).

As it is, I open a command (different commands on Unix and NT) as a file handle and pipe to it. I would like a way to set up the same mailing system so that I only have one version of this script for both Unix and NT.

I know that Mail::Mailer is generall Unix specific, as are most Mail type modules on CPAN. Is there one available that is good for both NT and Unix?

J. J. Horner
Linux, Perl, Apache, Stronghold, Unix
jhorner@2jnetworks.com
  • Comment on SMTP Modules that are both Win32 and Unix compliant

Replies are listed 'Best First'.
Re: SMTP Modules that are both Win32 and Unix compliant
by lachoy (Parson) on Apr 23, 2001 at 19:33 UTC

    You didn't look hard enough (CPAN is quite big!): Mail::Sendmail is pure-Perl, cross-platform, available for install via PPM and extremely simple to use. Take a look.

    Chris
    M-x auto-bs-mode

      I've found MIME::Lite to be a good cross-platform MIME emailer. For an example that I've tested on both NT and Unix, see RE: sending email.

      Chris
      M-x auto-bs-mode

      I second the notion. This module rocks (although getting it to handle MIME encoding is a bit of a hassle, but there is an example to help you get started). Mime::Tools handles this aspect well enough, but wants to deal with addressing the message as well, so it gets a bit conflictual between the two.

      I had a vague idea of making Mail::Sendmail Mime::Tools-aware, but the former is written pretty crappily and it exhausted my tuit supply.

      That said, I still reach for this module first when I need to sling email around, and, despite what the name would have you believe, it does not require sendmail(1)


      --
      g r i n d e r
      This begs the question why are there so many modules for the same functionality... (And therefore, what is a good way to reduce this complexity of finding relevant modules)
Re: SMTP Modules that are both Win32 and Unix compliant
by rchiav (Deacon) on Apr 23, 2001 at 19:14 UTC
    This may be over-obvious, but how about Net::SMTP? I mean if you're just sending mail through an SMTP server, Net::SMTP will provide the same functionality on both..

    Rich

Re: SMTP Modules that are both Win32 and Unix compliant
by suaveant (Parson) on Apr 23, 2001 at 19:13 UTC
    Mail::Sender works well under linux, and the Config.pl mentions how to compile in windows, though windows is not directly mentioned in the readme. It should work. It's easy to use, and handles attachments even.
                    - Ant
Re: SMTP Modules that are both Win32 and Unix compliant
by BigJoe (Curate) on Apr 23, 2001 at 22:01 UTC
    I use Net::SMTP on both NT and Linux systems. I ftp the script from one OS to the other and I don't reconfigure anything except the out bound mail server needs to allow relaying from the machine that is sending it. That is a whole other can of worms.

    --BigJoe

    Learn patience, you must.
    Young PerlMonk, craves Not these things.
    Use the source Luke.
Re: SMTP Modules that are both Win32 and Unix compliant
by princepawn (Parson) on Apr 23, 2001 at 22:17 UTC
    A bit off-topic, but Emacs comes with smtp.el and sendmail.el which I have found useful for sending mail within emacs.

    And of course you can evoke them from the shell with Emacs's command line arguments.

Re: SMTP Modules that are both Win32 and Unix compliant
by Makull (Initiate) on Apr 24, 2001 at 13:57 UTC
    Yes, you can use Mail::Sender for this.. it is supported for both Unix and Windows and can also send attachments.