Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm configuring a SMTP server based on Postfix with PostgreSQL. When I try to send a mail to another domain I got a Recipient address rejected: Access denied error.

Here is my configuration :

# postconf -n

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
inet_interfaces = all
local_recipient_maps = 
mailbox_size_limit = 0
mydestination = lan.example.com, localhost, localhost.localdomain, localhost
myhostname = example.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
readme_directory = no
recipient_delimiter = +
relayhost = lan.example.com
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
smtpd_recipient_restrictions = permit_mynetworks, permit_auth_destination, reject
virtual_alias_maps = pgsql:/etc/postfix/pgsql.d/virtual_alias.cf
virtual_gid_maps = static:108
virtual_mailbox_base = /var/spool/postfix/incoming
virtual_mailbox_domains = pgsql:/etc/postfix/pgsql.d/virtual_domain.cf
virtual_mailbox_limit = 51200000
virtual_mailbox_maps = pgsql:/etc/postfix/pgsql.d/virtual_mailbox.cf
virtual_transport = virtual
virtual_uid_maps = static:105

Here, example.com is the domain name of the server, and lan.example.com is the domain name of the relay host.

Here is the complete error :

Oct 15 10:22:08 authentification postfix/smtpd[9930]: connect from unknown[10.1.250.173]
Oct 15 10:22:08 authentification postfix/smtpd[9930]: NOQUEUE: reject: RCPT from unknown[10.1.250.173]: 554 5.7.1 <david.jose.delassus@gmail.com>: Recipient address rejected: Access denied; from=<noreply@example.com> to=<david.jose.delassus@gmail.com> proto=ESMTP helo=<localhost>
Oct 15 10:22:08 authentification postfix/smtpd[9930]: lost connection after RSET from unknown[10.1.250.173]
Oct 15 10:22:08 authentification postfix/smtpd[9930]: disconnect from unknown[10.1.250.173]
share|improve this question

1 Answer 1

up vote 0 down vote accepted

If I'm not misunderstanding your question, you want to send mail through lan.example.com. If lan.example.com is the same box, relayhost = lan.example.com should not be set (as this is already the relay host).

From the postfix documentation

By default, the Postfix SMTP server accepts:

  Mail from clients whose IP address matches $mynetworks, or
  Mail to remote destinations that match $relay_domains, except for addresses
   that contain sender-specified routing (user@elsewhere@domain), or
  Mail to local destinations that match $inet_interfaces or $proxy_interfaces,
    $mydestination, $virtual_alias_domains, or $virtual_mailbox_domains.

You should specify the network 10.1.250.0/24 (or whatever bit mask) to be part of $mynetworks, or, specifically put it into smtpd_relay_restrictions:

smtpd_relay_restrictions = $mynetworks, 10.1.250.0/24
share|improve this answer
    
Thanks, the problem was solved by adding 10.0.0.0/8 to $mynetworks –  linkdd Oct 15 '12 at 12:38
    
smtpd_relay_restrictions is new to postfix 2.10, which is still under development. Apart from that, this setting does not accept lists of hosts or IP ranges - it accepts only restrictions. You may be thinking of relay_domains, or something else. –  adaptr Oct 15 '12 at 15:15
    
@adaptr: you are mistaken. If you do not specify smtpd_relay_restrictions it defaults to $mynetworks, reject. You just have to try it to be sure ;). relay_domains only suits you for relaying mail for specific domains. –  Torian Oct 15 '12 at 19:37
    
$mynetworks is not a valid restriction. –  adaptr Oct 16 '12 at 10:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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