I have a sendmail server running that currently only accept to send mail coming from localhost. Everything going out is masqueraded as @mywebsite.com and there is DKIM SPF MX and A record bound to the server.

I have installed dovecot IMAP on the server to access mail received on the server from my computer at home.

I would like to be able to send mails from my home computer to my sendmail server as one of the sendmail server user. (smtp outgoing box)

But I need to protect this user with a password to avoid becoming a spam relay.

I want my mail to run through the server to enjoy the DKIM SPF MX and A Record.

  • Use a VPN into the server (e.g. stunnel) it'll be a lot simpler. – symcbean Jun 19 '13 at 13:21
  • okay i'll check that but vpn for 30 machines is okay? – Nicolas Manzini Jun 19 '13 at 13:27
  • - this waqs not mentioned in the question I answered - but yes, indeed the more clients, the more sensible it is to use stunnel (wraps individual connections) rather than a fuly tunnelled network adapter – symcbean Jun 19 '13 at 13:36
  • Could you name email client you use? Some email clients support more ways than others. – AnFi Jun 19 '13 at 17:06

There's nothing wrong with the VPN suggestions that have already been made, but sendmail is capable of handling this at the application layer.

If you want to do this, there are two parts: set up sendmail so that it supports TLS (encryption), and set up sendmail so that it supports relaying-after-SMTP-AUTH (which allows authentication over the encrypted SMTP channel, and tells sendmail to allow relaying from clients who have so authenticated).

For TLS support, you need the following in your sendmail.mc:

define(`confCACERT_PATH', `/etc/pki/tls/certs')dnl
define(`confSERVER_CERT', `/etc/pki/tls/certs/server.crt')dnl
define(`confSERVER_KEY', `/etc/pki/tls/certs/server.key')dnl

You will also need to create the (self-signed) certificate and key files; there are a lot of tutorials out on the net about doing that, so I don't propose to go over it again here.

For SMTP AUTH and relaying support, you need the following in your sendmail.mc:

define(`confAUTH_OPTIONS', `A p y')dnl

I also found that I needed the following line in /etc/sasl2/Sendmail.conf:


and that saslauthd needed to be running. That enabled me to log in using the same credentials that I use to authenticate against dovecot, and sendmail was then happy to relay my emails.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.