You are not logged in.

#1 2016-10-16 11:59:18

iMBeCil
WAAAT?
From: Edrychwch o'ch cwmpas
Registered: 2015-09-29
Posts: 767

mutt based email setup - MUA, MTA, MRA, XYZ ... advice, please?

I would like an advice from gurus here ... what would you recommend (and/or use) for mutt-based email setup on your linux box? (Clearly, it is would not be specific to BunsenLabs or even to debian ...)

Some background: so far I have used a GUI clients (mostly Sylpheed and/or Claws-mail). Now I decided to go back to CLI, and as an obvious choice mutt emerged, as it comes already preinstalled in most debian-installation scenarios (netinstall in my case). To my surprise, it turns not to be an straightforward solution ... I (finally) got into the 'complicated' structure of mail stuff: MUA, MTA, MRA ... and so on. And I think I understand most of this, however, I need an advice on some points (see below).

What I know/understand:
- mutt is solely an MUA, or plainly mail-reader and mail-composer (although it can be more, but I would like to follow unix 'one tool for one task'-philosophy)
- I know I need fetchmail, and I plan to use procmail
- MTA exim4 comes preinstalled on debian in most cases, configured

What I have:
- laptop with some sort of debian (netinstall, with custom installed minimal X ...), obviously with working network connection
- the laptop is not meant to be a full-blown mail server; I am the only user
- the laptop is regularly connected to various WiFis/routers, so it doesn't have and cannot have fixed address, nor MX record (no DNS record)
- I want to do emailing via my employer servers (i.e. I want to connect to the 'smarthost', in debian parlance)

My qusetion:
What would you suggest as a MTA? If you are mutt-user, how did you setup it? Does it have to be exim4? Other suggests postfix (which is also a full-blown email server). Something else? NB: I'm not afraid of editing huge configuration files, and or read tons of documentation ... rather, I prefer a flexible/configurable solution (with procmail, spamassasin in mind) in the spirit of unix.

Sorry for Tl;DR, couldn't make it shorter, have to show that I did my homework smile . And thanks for the answers. If I succeed, I promise a tutorial here on BL forum.


Postpone all your duties; if you die, you won't have to do them ..

Offline

#2 2016-10-16 12:11:06

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: mutt based email setup - MUA, MTA, MRA, XYZ ... advice, please?

iMBeCil wrote:

What would you suggest as a MTA? If you are mutt-user, how did you setup it? Does it have to be exim4?

exim4 appears to be the Debian default so you should probably try that.

https://wiki.debian.org/Exim

For my CLI email stuff I prefer smptd(8) & sendmail(8) glasses

The latter is available in Debian:

https://packages.debian.org/jessie/sendmail

I have to say though that I don't send many emails (maybe not even one a month) so my opinion here probably isn't worth much.

EDIT:

Sendmail is the *ONLY* MTA with a Turing complete language to control *ALL* aspects of delivery!

cool

Last edited by Head_on_a_Stick (2016-10-16 12:12:00)


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#3 2016-10-16 15:04:52

twoion
ほやほや
Registered: 2015-08-10
Posts: 2,932

Re: mutt based email setup - MUA, MTA, MRA, XYZ ... advice, please?

Well. Email is an extremely flexible medium.

exim4 and sendmail configuration is insane and tedious, exim4's for its crappy config system and sendmail's for arcane magic. postfix is what you want to use if you want to set up a new MTA nowadays. It also has the best documentation. Configuration is straightforward if you understand email.

I'm also using mutt. There are scenarios for sending and receiving email.

Sending email: If you are on a laptop and want to "send" email immediately even if you are not connected to any network, that is you want to queue emails for sending and automagically send them out when you go online again, you should use postfix. Mutt will use 'sendmail' to insert the outgoing email into the mail system, and postfix will handle the queueing and the relaying to your upstream SMTP server (called a 'smart host' in postfix terms), as well as periodically retry sending out your email. Postfix is also a powerful tool that let's you filter and hook outgoing (as well as incoming email) any way you can imagine.

Different are programs (but still called MTAs) like ssmtpd or msmtp or similar: They are for sending email immediately to upstream SMTP servers and will just fail if you are not online. Mutt postpones the mail and you have to re-send all postponed messages manually (or some kind of macro or helper script).

IMHO using a MTA for outgoing email yields a more elegant system.

Receiving email: Using a MTA for receiving email is unhandy if you're not an internet site (static IP address, always on, etc). Usually you'd use a program like fetchmail to insert email polled from IMAP or POP mailboxes into the local email system. You can also use these tools without a MTA in so-called single-drop mode that will just save email to where you point the program to.

Using a MTA this way can be nice if you want simple integration with tools like procmail, spamassassin or an anti-virus scanner, that is a filter chain for incoming email. Of course, these tools can be used without a MTA too!

Note that mutt has a built-in IMAP client, but this limits you to accessing your inbox only while being online. I prefer having an offline archive of all my important email.

To sum up:

[fetchmail ->] MTA -> clamav -> spamassassin -> procmail -> MUA

for receiving and

MUA -> MTA-queueing|MTA-nonqueueing -> upstream SMTP server

for sending.

My personal setup is:

fetchmail -> spamassassin -> procmail -> mutt (with notmuch) -> msmtp

It just werks™.

PS. Do not forget to configure/enable TLS properly if you try out postfix and authenticate against your upstream servers wink

PPS. This is an interesting topic for a change, moving to sysadmin corner.

PPPS. Sharing a postfix TLS configuration from an internet site to get you started:

# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_tls_security_level = may 
smtpd_tls_auth_only = yes
# For interoperability
smtpd_tls_mandatory_protocols = !SSLv2,!SSLv3
smtpd_tls_protocols=!SSLv2,!SSLv3
smtpd_tls_mandatory_ciphers = medium
smtpd_tls_loglevel = 2
smtpd_tls_received_header = yes 
smtp_tls_security_level = may 
smtp_tls_loglevel = 1 

Instead of using opportunistic TLS (may), you probably want to enforce it always when sending email to upstream.

.PPPPS msmtprc TLS config

defaults
tls on
tls_starttls on
tls_certcheck on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
# Adjust for what your upstream SMTP server supports...
tls_priorities NONE:+VERS-TLS1.2:+VERS-TLS1.1:+VERS-TLS1.0:-VERS-SSL3.0:+ECDHE-RSA:+DHE-RSA:+RSA:+AES-128-GCM:+AES-128-CBC:+AES-256-CBC:+SIGN-RSA-SHA256:+SIGN-RSA-SHA384:+SIGN-RSA-SHA512:+SIGN-RSA-SHA224:+SIGN-RSA-SHA1:+SIGN-DSA-SHA256:+SIGN-DSA-SHA224:+SIGN-DSA-SHA1:+CURVE-ALL:+AEAD:+SHA256:+SHA384:+SHA1:+COMP-NULL

Per aspera ad astra.

Offline

#4 2016-10-16 19:42:25

iMBeCil
WAAAT?
From: Edrychwch o'ch cwmpas
Registered: 2015-09-29
Posts: 767

Re: mutt based email setup - MUA, MTA, MRA, XYZ ... advice, please?

Thanks a lot HoaS and 2ion, your answers are really insightful.

@HoaS. I am aware of smtpd and sendmail (ugh!), but on numerous places I have seen comments similar to 'don't use sendmail if you don't have to'. I gather, sendmail is a dinosaur, and an ugly one smile (yet somehow ubiquitous and often it is installed by default, or symlinked to more modern MTA). Perhaps, once, when I master some other MTA, I will return to sendmail ...

@2ion: you nailed it! Advice I was searching for. Actually, I suspected that the postfix is way to go, but was kind of confused with preinstalled exim on debian ... And, yes, I know about the TLS, my 'smarthost' is already using it, i.e. my Sylpheed is configured to use it.

Thanks again for taking the time to answer my question. I will try postfix, and see how complicated it is.


Postpone all your duties; if you die, you won't have to do them ..

Offline

#5 2016-10-21 08:32:17

Snap
Member
Registered: 2015-10-02
Posts: 465

Re: mutt based email setup - MUA, MTA, MRA, XYZ ... advice, please?

@ twoion: Amazing writeup. Thanks for the condensed info that one usually needs to grab/grasp from bits coming from so many places.

Offline

Board footer

Powered by FluxBB