I've got a nice little mail server setup (running Ubuntu Server 16.04) that works a treat. It uses postfix as SMTP, which uses dovecot (IMAP) as an authentication source for virtual mailbox users.
It's been working fine, but now I have a second server in another location (with a dynamic IP address), which I'd like to be able to send mail through my main mail server. I've seen a guide on setting it up in authenticated-relay mode, and am part-way through the process, but then I realised that I'd need a send-only email account for it to authenticate against, as I don't want it to be able to receive mail and fill up the server's hard drive (I won't check the inbox!).
How can I create a new email account in my virtual users setup that doesn't have a mailbox, but can still connect via SMTP and send emails?
The easiest solution would be to add the user just like any other user, but restrict recipient. This will give an error during
RCPT TO
regardless whether the user actually exists or not.For example, if a web page of a company might send some emails using
[email protected]
as a sender address, while no-one should read that address but only their[email protected]
addresses, and the server hasmydestination = example.com
that would normally deliver to that user, I'd simply add (without removing what there already is insmtpd_recipient_restrictions
):Then add the unallowed addresses there with a friendly and human readable reason for the reject:
That should work what ever is the reason you don't want to accept mail for an address. Remember to
postmap /etc/postfix/access/denied_recipients
as the lookup table is ahash
type Berkeley DB.