2013-08-19 68 views
5

我試圖從Outlook客戶端發送郵件時發生此錯誤554 Relay access deniedLinux postfix/dovecot 554中繼訪問被拒絕

我可以閱讀收到的郵件,但無法發送。

如果我連接telnet localhost 25我可以發送外部電子郵件,但與Outlook客戶端不起作用。

這裏是我的Postfix和Dovecot的配置:

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 
mailbox_size_limit = 0 
mydestination = localhost 
myhostname = mail.mydomain.com 
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 
myorigin = /etc/mailname 
readme_directory = no 
recipient_delimiter = + 
relayhost = 
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu) 
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination 
smtpd_sasl_auth_enable = yes 
smtpd_sasl_path = private/auth 
smtpd_sasl_type = dovecot 
smtpd_tls_auth_only = yes 
smtpd_tls_cert_file = /etc/ssl/certs/dovecot.pem 
smtpd_tls_key_file = /etc/ssl/private/dovecot.pem 
smtpd_use_tls = yes 
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf 
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf 
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf 
virtual_transport = lmtp:unix:private/dovecot-lmtp 

doveconf -n

# 2.1.7: /etc/dovecot/dovecot.conf 
# OS: Linux 3.9.3-x86_64-linode33 x86_64 Ubuntu 13.04 ext3 
auth_mechanisms = plain login 
mail_location = maildir:/var/mail/vhosts/%d/%n 
mail_privileged_group = mail 
namespace inbox { 
    inbox = yes 
    location = 
    mailbox Drafts { 
    special_use = \Drafts 
    } 
    mailbox Junk { 
    special_use = \Junk 
    } 
    mailbox Sent { 
    special_use = \Sent 
    } 
    mailbox "Sent Messages" { 
    special_use = \Sent 
    } 
    mailbox Trash { 
    special_use = \Trash 
    } 
    prefix = 
} 
passdb { 
    args = /etc/dovecot/dovecot-sql.conf.ext 
    driver = sql 
} 
passdb { 
    args = /etc/dovecot/dovecot-sql.conf.ext 
    driver = sql 
} 
protocols = imap pop3 lmtp 
service auth-worker { 
    user = vmail 
} 
service auth { 
    unix_listener /var/spool/postfix/private/auth { 
    group = postfix 
    mode = 0666 
    user = postfix 
    } 
    unix_listener auth-userdb { 
    mode = 0600 
    user = vmail 
    } 
    user = dovecot 
} 
service imap-login { 
    inet_listener imap { 
    port = 0 
    } 
} 
service lmtp { 
    unix_listener /var/spool/postfix/private/dovecot-lmtp { 
    group = postfix 
    mode = 0600 
    user = postfix 
    } 
} 
service pop3-login { 
    inet_listener pop3 { 
    port = 0 
    } 
} 
ssl = required 
ssl_cert = </etc/dovecot/dovecot.pem 
ssl_key = </etc/dovecot/private/dovecot.pem 
userdb { 
    args = uid=vmail gid=vmail home=/var/mail/vhosts/%d/%n 
    driver = static 
} 
userdb { 
    args = uid=vmail gid=vmail home=/var/mail/vhosts/%d/%n 
    driver = static 
} 

有什麼想法?

+0

哪裏是你的 'Outlook客戶端' 無法連接?你在使用認證嗎?你只有在'mynetworks'中有本地主機,你可能想要添加網絡計算機應該被允許從那裏發送郵件。 – mata

+0

它在我家的電腦上。是的,我使用SSL。我的網絡 ?所以我應該添加我的家庭電腦的inet ip? –

+0

不,我不是說ssl(加密),而是認證(當你通過postfix通過smtp發送郵件時,你有沒有設置outlook來驗證你的用戶?)。 'mynetwork'允許中繼訪問,而不需要本地網絡的身份驗證,如果你的服務器在互聯網上的某個地方,那麼你最好使用smtp_auth。 – mata

回答

5

如果使用後綴版本更新則2.10,那麼你需要添加smtpd_relay_restrictions選項描述here

 
# With Postfix 2.10 and later, the mail relay policy is 
# preferably specified under smtpd_relay_restrictions. 
/etc/postfix/main.cf: 
    smtpd_relay_restrictions = 
    permit_mynetworks 
    permit_sasl_authenticated 
    reject_unauth_destination 

# Older configurations combine relay control and spam control under 
# smtpd_recipient_restrictions. To use this example with Postfix ≥ 
# 2.10 specify "smtpd_relay_restrictions=". 
/etc/postfix/main.cf: 
    smtpd_recipient_restrictions = 
    permit_mynetworks 
    permit_sasl_authenticated 
    reject_unauth_destination 
     ...other rules... 

之後,所有SASL身份驗證的用戶應該能夠通過發送郵件服務器使用smtp。

+1

這不適合我。我得到同樣的錯誤。 – neckTwi

0

對於我在Amazon AWS EC2上的postfix 2.6.6,事實證明我在main.cf中配置了「mydestination」和「relay_domains」設置。 正確的價值觀(那些其工作對我來說),分別爲:

mydestination = $myhostname, $mydomain, localhost relay_domains = $mydestination

+0

我的域名是'necktwi.com'。我已將服務器重命名爲'ec2',myhostname ='ec2.necktwi.com'和mydomain ='necktwi.com'。但我得到了同樣的錯誤 – neckTwi