maddy mail and cron

While re-building my own server from 16.04 to 20.04 a new mail server had to came along. The whole setup with dovecot, postfix, clamAV / spamassassin is just not that much fun to deal with.

Everyone who setup a mail server or is trying to maintain a mailserver will agree that mail hosting is terrible right next to printers.

I’ve stubmbled upon maddy.email which is written in go and does everything except spam filtering (as of yet) out of the box.

the only issue is that i run maddy in a container and OS cron only sends mails if /bin/mail or /sbin/sendmail is on the system, so how do you get to send cron mails?

ssmtp & config in maddy

so the configuration for maddy, since 25,143,465 and 993 are occupied we are adding a new smtp local endpoint

## ---------
# local mail forward
smtp tcp://127.0.0.1:587 {
  default_destination {
    modify {
      dkim {
        domains $(primary_domain) $(local_domains)
        selector default
        key_path dkim_keys/{domain}-{selector}.key
        header_canon relaxed
        body_canon relaxed
        sig_expiry 72h # 3 days
        hash sha256
        newkey_algo rsa2048
      }
    }
    deliver_to &outbound_delivery
  }
}

this endpoint accepts “normal” smtp (if no global tls is enabled) on localhost and applies dkim and for ssmtp

root=some-external-mail-addr
mailhub=localhost:587
rewriteDomain=alexdpsg.net
# AuthUser=username
# AuthPass=password
# FromLineOverride=YES
UseTLS=YES

after that cron sends happy mails.

2021-08-17T12:48:01.800Z smtp: incoming message  {"msg_id":"","sender":"root@alexdpsg.net","src_host":"extern","src_ip":"127.0.0.1:57964"}
2021-08-17T12:48:02.194Z smtp: RCPT ok   {"msg_id":"0c9c78ca","rcpt":"some-external-mail-addr"}
2021-08-17T12:48:04.360Z smtp: accepted  {"msg_id":"0c9c78ca"}