Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: MTA for Perl

by philipbailey (Curate)
on Mar 18, 2024 at 23:46 UTC ( [id://11158369]=note: print w/replies, xml ) Need Help??


in reply to MTA for Perl

I'm assuming you are using Linux or Unix. My take is that any of Sendmail, Exim or Postfix are fine as MTAs and as a starting point would consider whichever is a default on your OS or distro, as it's more likely to have a good basic setup out of the box. I've used all 3 at various times. My perception is that as any of these MTAs is more than sufficiently performant for common use cases, the complexity of configuration is a big deciding factor if you are considering choosing a non-default MTA for your OS.

Sendmail, the oldest widely-used MTA, has a notoriously opaque low-level config file, though there are some higher level abstractions available; I therefore rank Sendmail as worst for configuration complexity. When Postfix was supplied with a new (to us) OS version some years ago, I rather fell in love with the comparative simplicity and power of its configuration and so now use Postfix personally, whenever I have a choice. Exim has an intermediate level of difficulty.

So what about MIME::Lite and its use of "sendmail". Well, it so happens that both Exim and Postfix come with a "sendmail" command as standard, which mimics at least the core functionality of Sendmail's CLI. MIME::Lite looks in /usr/bin/sendmail, /usr/sbin/sendmail and then for a sendmail command in your PATH. So it's likely to work just fine with any of these MTAs without any work. I'll leave the question (also mentioned by 1nickt) of whether to use MIME::Lite given the statement these days in its documentation that it's no longer recommended (though I have used it without problem in years gone by).

Replies are listed 'Best First'.
Re^2: MTA for Perl
by Bod (Parson) on Mar 19, 2024 at 10:34 UTC
    I'm assuming you are using Linux or Unix. My take is that any of Sendmail, Exim or Postfix are fine as MTAs and as a starting point would consider whichever is a default on your OS or distro, as it's more likely to have a good basic setup out of the box.

    Yes - it's Linux

    It's a Raspberry Pi which doesn't come with an MTA as default. Hence why I need to make a choice. I'm also treating it as a learning experience. This isn't mission critical so a few mistakes along the way won't hurt and will increase my knowledge 🙂

    Well, it so happens that both Exim and Postfix come with a "sendmail" command as standard...

    Oh! That's helpful information - thank you.

    Given everything I now know, Postfix will be the MTA of choice.

      Adding a bit to that, the real question is how you want the mail to flow. An MTA like Postfix will manage its own queue, so your program writes out a mail message and gets "success" that it has been delivered to Postfix. If Postfix has a problem delivering it, you'll need separate monitoring to find out about that, and meanwhile the messages will pile up in the queue on the raspberry Pi. The other way is to deliver mail directly from your app to some external SMTP host, like a relay service from your internet provider, or SendGrid, or something like that. If you can't push the message to them, the error can be handled and reported in the application. This also saves you the hassle of setting up an MTA, which is nice, unless your whole goal was to learn about MTAs.

        I think you need some secondary part monitoring the send status, bounces etc. anyway, at least if you are serious about sending mail and not having it marked as spam. Sisimai does the analysis (I have not used it). But you have to go beyond "mail was handed off to MTA" anyway.

        An MTA like Postfix will manage its own queue, so your program writes out a mail message and gets "success" that it has been delivered to Postfix.

        Nullmailer does exactly that, and ONLY that. The really great part about nullmailer is that it needs very little configuration compared to huge packages like postfix or exim, and it is harder to get the configuration wrong. The Debian wiki explains the configuration quite well, and so does the Arch-Linux wiki.

        If Postfix has a problem delivering it, you'll need separate monitoring to find out about that, and meanwhile the messages will pile up in the queue on the raspberry Pi.

        I usually have some cron jobs running on all machines, at least some kind of backup, a disk full check, or SMART and RAID integrity checks. So I get one cron-job mail per day per machine. If I don't get that mail, something is wrong. No extra monitoring needed.

        Alexander

        --
        Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
        unless your whole goal was to learn about MTAs

        That is a big part of it...it's the reason I'm not just pushing them out to SendGrid or Brevo which we already use.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11158369]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (4)
As of 2024-09-18 14:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The PerlMonks site front end has:





    Results (25 votes). Check out past polls.

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.