歡迎您光臨本站 註冊首頁

求助,postfix無法外發郵件。各位大大們,幫忙啊。。。

←手機掃碼閱讀     火星人 @ 2014-03-04 , reply:0

求助,postfix無法外發郵件。各位大大們,幫忙啊。。。

本機上各域郵件之間互發都沒有問題。但外發就報錯。
錯誤信息:
mail:~# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 mail.example.com ESMTP Postfix (Debian/GNU)
helo example.com
250 mail.example.com
mail from:<ops@example.com>
250 2.1.0 Ok
rcpt to:<myemail@gmail.com>
550 5.1.1 <myemail@gmail.com>: Recipient address rejected: User unknown in local recipient table
quit
221 2.0.0 Bye
Connection closed by foreign host.
main.cf配置內容如下:++++++++++++++++++++++++++++++++++

# See /usr/share/postfix/main.cf.dist for a commented, more complete version


# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

# TLS parameters
smtpd_tls_cert_file = /etc/ssl/certs/postfix.pem
smtpd_tls_key_file = /etc/ssl/private/postfix.pem
smtpd_use_tls = yes
smtpd_tls_session_cache_database = btree:${queue_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${queue_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

myhostname = mail.example.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = mail.example.com, mail.example.cn, gmail.com, localhost
relayhost =
mynetworks =
#121.52.210.0/24
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf,mysql:/etc/postfix/mysql-email2email.cf
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination
smtpd_tls_auth_only = yes
smtpd_client_restrictions = permit_sasl_authenticated
smtpd_sasl_security_options = noanonymous
《解決方案》

mail:/etc/postfix/sasl# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 mail.example.com ESMTP Postfix (Debian/GNU)
ehlo example.com     
250-mail.example.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from:<ops@example.com>
250 2.1.0 Ok
rcpt to:<myemail@gmail.com>
554 5.7.1 <myemail@gmail.com>: Relay access denied
quit
221 2.0.0 Bye
Connection closed by foreign host.

報錯后的/var/log/mail.log錯誤記錄如下:================
May 26 19:29:59 mail postfix/smtpd: NOQUEUE: reject: RCPT from unknown: 554 5.7.1 <myemail@gmail.com>: Relay access denied; from=<ops@example.com> to=<myemail@gmail.com> proto=ESMTP helo=<example.com>
May 26 19:30:07 mail postfix/smtpd: disconnect from unknown
《解決方案》

樓主的DNS解析有誤,你沒有做好正確的DNS解釋,A.MX記錄。
       明眼一看就是照抄的網上的配置,看網上的教程是好的,但是你得把本地的域名改了。
example.com 是人家的域名,解析是別人的公網IP,怎麼可能讓你發郵件。
    如果這樣也能發,那我搞個  qq.com然後再向別人用戶發郵件,發個什麼中獎的郵件,那我可是發財了。呵呵。。。
《解決方案》

原帖由 wzhihai 於 2009-5-26 19:34 發表 http://bbs2.chinaunix.net/images/common/back.gif
mail:/etc/postfix/sasl# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 mail.example.com ESMTP Postfix (Debian/GNU)
ehlo example.com     
250-m ...


沒有認證就向外域發件當然不成功。要是這樣也能發成功,那你的郵件伺服器就是open relay了。
《解決方案》

DNS解析肯定是正確的。example.com是發貼的時候改的。配置裡邊當然不會用這個域名,因為伺服器放在公網上,目前處理測試階段,沒有開任何防護,所以一開始沒有用真正的域名。

下邊是用outlook以身份驗證方式發送郵件。也是同樣發送不成功,以下是mail.log的錯誤記錄。顯示verification failed: Name or service not known,所以我懷疑是那個地方配置不對,造成對外發送受限制。

May 27 09:36:25 mail postfix/smtpd: warning: 124.126.148.31: hostname 31.148.126.124.broad.bjtelecom.net verification failed: Name or service not known
May 27 09:36:25 mail postfix/smtpd: connect from unknown
May 27 09:36:25 mail postfix/smtpd: NOQUEUE: reject: RCPT from unknown: 554 5.7.1 <wzhihai@gmail.com>: Relay access denied; from=<ops@olship.cn> to=<wzhihai@gmail.com> proto=ESMTP helo=<wzh>
May 27 09:36:25 mail postfix/smtpd: disconnect from unknown
《解決方案》

以下是現在的main.cf主要配置部分:

myhostname = mail.olship.cn
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = mail.olship.cn, localhost
relayhost =
mynetworks = 121.52.210.8
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf,mysql:/etc/postfix/mysql-email2email.cf
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination
smtpd_tls_auth_only = yes
smtpd_client_restrictions = permit_sasl_authenticated
smtpd_sasl_security_options = noanonymous
《解決方案》

550 5.1.1 <myemail@gmail.com>: Recipient address rejected: User unknown in local recipient table


還有Relay access denied;


看這些啊
《解決方案》

本地telnet登錄報銷信息。提示沒有驗證方法????
mail:~# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
ehlo olship.cn
220 mail.olship.cn ESMTP Postfix (Debian/GNU)
250-mail.olship.cn
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
auth plain ZHJ5Q9sGc2hpcC5jbgercnlAb23zaGlwLmNuAGdsdWU=
538 5.7.0 Encryption required for requested authentication mechanism

另外Recipient address rejected: User unknown in local recipient table,是那條設置的問題啊?
《解決方案》

mynetworks_style = host

加上這個,telnet localhost 25 不用認證
《解決方案》

加上mynetworks_style = host沒有任何效果,以下是加上之後不做認證發送郵件,直接relay access denied。那位大俠能先告訴我一下,relay access denied是為什麼?那條語句控制的?

mail:~# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 mail.olship.cn ESMTP Postfix (Debian/GNU)
ehlo olship.com
250-mail.olship.cn
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from:<ops@olship.cn>
250 2.1.0 Ok
rcpt to:<wzhihai@gmail.com>
554 5.7.1 <wzhihai@gmail.com>: Relay access denied

[ 本帖最後由 wzhihai 於 2009-5-27 10:23 編輯 ]

[火星人 ] 求助,postfix無法外發郵件。各位大大們,幫忙啊。。。已經有1890次圍觀

http://coctec.com/docs/service/show-post-22426.html