Sendmail/smart host with mysmtp.eu/smtp.dk

Hi,

My internet service provider (ISP, Eniig) has announced that they will no longer provide a SMTP relay host (outgoing Simple Mail Transfer Protocol relay), and on top of that they earlier they stated that they will not setup reverse DNS on my fixed IP – so with these two (really bad) decisions in mind, I had to come up with a solution.

By the way – Eniigs reason for not providing SMTP relay servides anymore is that they apparently cannot manage to have such a server in production anymore because of SPAM anti measures etc. Really? An ISP not having the resources and knowledge to run a SMTP server in production anymore? Really!?!?!

Anyway – Eniig suggested using https://smtp.dk/ and even provides a free (almost unlimited) access until end of May 2018, so although there is a lot of cheaper alternatives out there – why not?
For non-Danish speakers wanting to join, smtp.dk also runs an international version of their service on https://mysmtp.eu/.

Only problem is that it requires SMTP to the submit port (587) and authentication. And it is a requirement for me to continue to use my FreeBSD/Sendmail box, which is providing a lot of services – including some rarely used SMTP-services – for family and friends. This is actually a non-profit/free setup – so it is a pita that Eniig actually are putting extra costs into this, without reducing the cost for the Internet connection. Shame on them!!!

Actually, it was not that big of a hassle to configure Sendmail for this purpose – and I’m also doing SMTP authentication, SpamAssassin filtering, procmail  and a lot of other stuff in my Sendmail :-).

This is what I had to do:

1.
Create /etc/mail/authinfo with one line (terminate it with a line break):

AuthInfo:smtp.dk "U:root" "I:<smtp.dk login name>" "P:<smtp.dk password>" "M:LOGIN PLAIN"

…replacing values in < > with you accounts values from smtp.dk
I feel most secure by making this file rw for root only

2.
Run makemap of this file to create a authinfo.db-file

makemap hash authinfo < authinfo

3.
Correct your sendmail.mc-file (whatever it is called on your system). Add these lines:

define(`SMART_HOST',`[smtp.dk]')dnl
define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl
FEATURE(`authinfo',`hash /etc/mail/authinfo')dnl

Note: You should change this for the sendmail queue runner process, not a SMTP submit service etc.

4.
Compile your sendmail.mc file into a sendmail.cf file. This is easily done on FreeBSD 🙂

make cf

5.
Restart sendmail. Again – this is easy on FreeBSD

make restart

Also: remember to correct your SPF and similar setups on your domains according to smtp.dk/mysmtp.eu.

Leave a Reply

Your email address will not be published. Required fields are marked *