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

We have the option of moving our site to a box that uses either Ensim or Plesk as the control panel. (Them's the choices.) Plesk uses Qmail and Ensim uses sendmail.

Currently all of our perl script use either calls to sendmail or Mime::Lite. i.e

my $mail_cmd = '/usr/bin/sendmail -t'; open (MAIL, "|$mail_cmd") or Error('Mail Error',"Can't open SendMail<b +r>Error: $!");
How difficult will it be to adapt to Qmail? Will there be a lot of re-writing or will it simply be a matter of pointing $mail_cmd to Qmail instead of sendmail?? Aside from the example above, most of our scripts make extensive use of Mime::Lite, so I'd like to make sure they don't break.
--
Filmo the Klown

Replies are listed 'Best First'.
Re: QMail vs sendmail
by hiseldl (Priest) on Oct 02, 2002 at 01:10 UTC

    I recently installed qmail on my RedHat box. There is a sendmail emulation binary that is installed as part of the qmail distro. So, you 'should' be able to continue to call 'sendmail' even though it is calling qmail's sendmail emulator.

    --
    hiseldl
    What time is it? It's Camel Time!

Re: QMail vs sendmail
by ehdonhon (Curate) on Oct 02, 2002 at 01:12 UTC

    Porting your Perl code to use qmail instead of sendmail should be no problem at all. The qmail package includes a sendmail 'wrapper', so all of your code can still call /usr/bin/sendmail and it will emulate the old functionality.

      The same applies to the Exim MTA. On a Debian box I moved from Sendmail to Exim without a single hitch (inc. scripts et al).
Re: QMail vs sendmail
by blahblahblah (Priest) on Oct 02, 2002 at 04:10 UTC
    I have a script that sends mail by calling sendmail directly like in your example. Several of our customers are now using qmail with the sendmail emulation and the script works fine for them, sending various types of mime and plain text messages.

    The only problem we ran into with our first customer who tried the script with qmail was that it's pickier than sendmail about getting the end of line characters correct, whereas sendmail will take incorrectly formatted input without complaining. But if you use a module like Mime::Lite to generate the message I imagine it will do that correctly for you. (We haven't completely started relying on modules for email stuff just because it's usually easier and quicker to fix a couple of lines in our old code than to rewrite it to use modules to generate the mails.)

Re: QMail vs sendmail
by gav^ (Curate) on Oct 02, 2002 at 03:04 UTC
    The sensible thing to do is to port your scripts so they use something like Mail::Sendmail. This makes them portable and has the advantage of not having the risk (and overhead) of using other external programs.

    gav^

Re: QMail vs sendmail
by hans_moleman (Beadle) on Oct 03, 2002 at 03:52 UTC

    I work as a consultant. My scripts' target environment can change on a very frequent basis, and I can never count on a particular OS, or service.

    In this situation, I've found the most fruitful (if not most efficient) way to handle the mail issue is to use Net::Telnet to talk to my friendly local SMTP server. The advantage is that SMTP is a standard interface, and I don't have to worry about any local sendmail / Qmail / postfix / IIS strangeness....

    update: Took a look at Mail::Sendmail this afternoon. It fulfills all my requirements and then some! I'll be throwing away my hand rolled code now :).