Postfix + Dovecot: Create send-only email account
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 has mydestination = example.com
that would normally deliver to that user, I'd simply add (without removing what there already is in smtpd_recipient_restrictions
):
smtpd_recipient_restrictions =
. . .
check_recipient_access hash:/etc/postfix/access/denied_recipients,
. . .
check_recipient_access type:table
Search the specified access(5) database for the resolved
RCPT TO
address, domain, parent domains, orlocalpart@
, and execute the corresponding action.
Then add the unallowed addresses there with a friendly and human readable reason for the reject:
[email protected] REJECT Visit the web site for correct contact information.
[email protected] REJECT Please log in and use the helpdesk contact form.
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 a hash
type Berkeley DB.