2

I`m having problem configuring postfix to receive emails from any domain but block senders for only authenticated users in localhost

My main.cf is like :

mydomain = domainname myhostname = mail.$mydomain myorigin = /etc/mailname smtpd_banner = $myhostname biff = no append_dot_mydomain = no readme_directory = no mydestination = relayhost = mynetworks = 127.0.0.0/8 mynetworks_style = host mailbox_size_limit = 0 virtual_mailbox_limit = 0 recipient_delimiter = + inet_interfaces = all message_size_limit = 0 smtpd_helo_required = yes smtpd_delay_reject = yes disable_vrfy_command = yes smtpd_sender_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination 

In this case I can receive from any domain email but can send from localhost without authenticate.

If I change this line to :

smtpd_sender_restrictions = permit_sasl_authenticated,reject_unauth_destination 

then I can't receive email from other domains with error 554 5.7.1 <[email protected]>: Sender address rejected: Access denied, and can send from localhost if only authenticated.

How can I configure postfix to receive email from any domain and allow send only if authenticated including localhost?

1
  • What's the complete output of postconf -n? Commented Apr 9, 2015 at 1:46

1 Answer 1

2

Just going to quote from my working Postfix configuration:

smtpd_sender_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauthenticated_sender_login_mismatch, permit 

Note that this allows authenticated users to send mail with any FROM address they wish. If you want users to be able to send mail only with the email address they login with, use reject_sender_login_mismatch instead.

Also note that your configuration is incomplete. You will also need several other directives to complete the configuration, primarily smtpd_recipient_restrictions.

1
  • 3
    Why is the last permit necessary? Why ispermit_sasl_authenticated, permit_mynetworks, reject not enough? Commented Apr 9, 2015 at 7:54

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.