http://www.perlmonks.org?node_id=151338

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

Hi monks,

I am about to embark on a new project which will involve lots of single mail shots as well as many bulk mail shots. It will be running on a unix platform (not sure which one though).

I would like to know from your experience which mail module is the most sturdy and reliable and which modules to stay away from.

Costas

Replies are listed 'Best First'.
Re: Most reliable mail module
by lhoward (Vicar) on Mar 13, 2002 at 12:15 UTC
    I prefer to use MIME::Lite for generating the email itself and Net::SMTP for sending the email. MIME::Lite for me is a no-brainer because it makes it totally painless to add attachments, etc. I like to use Net::SMTP when it comes to actually sending the mail for a few reasons:
    • better error handling - you are controlling the SMTP exchange so if there are any errors anywhere in the process you can handle them exactly how you want to (you can switch to a fallback mailserver, queue the message for later, or something else).
    • significantly faster than forking off a sendmail process.
    The power of Net::SMTP comes at a price: more code. It won't be a one or two liner to send mail anymore because you'll need to handle the complete SMTP transaction with error checking, etc.
Re: Most reliable mail module
by Biker (Priest) on Mar 13, 2002 at 12:27 UTC

    If you have an smtp server available, I would like to recommend Mail::Sendmail which I frequently and successfully use in our shop.


    Everything will go worng!

Re: Most reliable mail module
by lachoy (Parson) on Mar 13, 2002 at 12:55 UTC
    IIRC, the Mail::Bulkmail module is supposed to be pretty sweet for sending bulk emails.

    Chris
    M-x auto-bs-mode

Re: Most reliable mail module
by EvdB (Deacon) on Mar 13, 2002 at 14:10 UTC

    I can't comment directly on the mail modules but I feel it might be worth stressing that the underlying layer of mail software is also important.

    I personally use qmail instead of sendmail, and although it is initially quite a chore to set up it runs itself very well once it is going.

    Also don't forget that mail often hangs around on the server until the other end is ready. You will also get bounces - you should have a plan for handling these. If appropriate use a mailing list program to manage the bulk emails - yo can set yourself to be the only poster and the software will then deaal with bounces, retrying and keeping track of which emails haven't gotten through.

    If you handle the bounces yourself then you may want to add a custom header to the emails so that you can keep track of who has gotten what. If this is not important you can just keep resending and only delete the email address from your records after three bounces or so.

    Finally; play nice. Provide an easy way of unsubscribing, and after the user unsubscribes send an email that tells them how to resubscribe again. This is very helpful when the users are changing their addresses.

Re: Most reliable mail module
by Stegalex (Chaplain) on Mar 13, 2002 at 13:59 UTC
    You want to check out Mime::Lite. Also, you want to learn about MIME types if you are going to be doing bulk mail. Are you designing an opt-in mailing list? If so, keep in mind that there are huge differences in the way different mail clients (Outlook, Eudora, AOL, Hotmail, Yahoo) handle multipart messages. I have had to make my bulk mailer smart enough to send text messages to Yahoo.com and multipart/alternative to hotmail.com, etc. Bulk mailing is not easy and it takes a long time to detect problems unless you test your messages against every conceivable mail client. Anyway, not to get off on a rant...Mime::Lite works well. Good luck!I like chicken.
Re: Most reliable mail module
by perrin (Chancellor) on Mar 13, 2002 at 15:13 UTC
    If you're using qmail, the best performance comes from adding directly to the queue. Check out Mail::QmailQueue.
Re: Most reliable mail module
by costas (Scribe) on Mar 13, 2002 at 15:57 UTC
    Thanks for the tips everyone.

    Just to say that i have to use sendmail as i am designing a system which will sit on a server which is already running sendmail for other processes (ie consistency needed).

    I have decided to use Net:SMTP because of its error handling and better features. However i am in two minds about wether to use Mail::Bulkmail for the bulk send or limit the use of modules used by looping through the Net:SMTP mail send i already have for bulk mail. My only worries here are obviously time and sturdyness.

    What would be your desicion?

    THanks
      Just to say that i have to use sendmail as i am designing a system which will sit on a server which is already running sendmail for other processes (ie consistency needed).

      Note that you can use qmail and install a replacement for the /usr/lib/sendmail binary to keep other programs working.

      /J