我使用Ubuntu Server 11.04和postfix / dovecot为我的公司build立了一个新的邮件服务器。 我是新来的,所以我有一些问题。 我得到它只适用于从LAN以外的任何地址接收邮件,我只能发送相同的域名。 如果我尝试发送一个新的消息到一个外部地址(例如Gmail)我有Relay denied 。
所以,我的服务器有2个networking接口,1为我的局域网(192.168.1.xxx)和一个公共静态IP地址。 我的领域,testingpourpose,是enti.centropaghe.it ,我创build一个MXloggingmail.enti.centropaghe.it
我的目标是得到一个完整的function性的imap / smtp / pop3服务器,双方都有validation,它可以发送电子邮件到所有地址:)
我发布了一些我的configuration文件,所以你可以挖掘它:
# 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 (Ubuntu) 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 readme_directory = no # TLS parameters smtpd_use_tls=yes smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache smtp_tls_session_cache_database = btree:${data_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. mydomain = enti.centropaghe.it myhostname = mail.enti.centropaghe.it mydestination = $myhostname, localhost.$mydomain, $mydomain, localhost relayhost = $mydomain mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 192.168.1.0/24 alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases myorigin = $mydomain mailbox_size_limit = 0 recipient_delimiter = + inet_interfaces = all default_transport = error relay_transport = error mail_spool_directory = /var/mail/
search enti.centropaghe.it nameserver 192.168.1.221 #is my dns server on my lan
127.0.0.1 localhost.localdomain localhost 192.168.1.148 mail.enti.centropaghe.it darwin
; <<>> DiG 9.7.3 <<>> enti.centropaghe.it mx ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 65356 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 3 ;; QUESTION SECTION: ;enti.centropaghe.it. IN MX ;; ANSWER SECTION: enti.centropaghe.it. 8381 IN MX 10 mail.enti.centropaghe.it. ;; AUTHORITY SECTION: centropaghe.it. 71334 IN NS dns2.telemar.it. centropaghe.it. 71334 IN NS dns.telemar.it. ;; ADDITIONAL SECTION: mail.enti.centropaghe.it. 7333 IN A 213.178.198.62 dns.telemar.it. 28595 IN A 213.178.196.1 dns2.telemar.it. 20154 IN A 213.178.195.254 ;; Query time: 1 msec ;; SERVER: 192.168.1.221#53(192.168.1.221) ;; WHEN: Wed Feb 29 15:24:47 2012 ;; MSG SIZE rcvd: 151
; <<>> DiG 9.7.3 <<>> enti.centropaghe.it any ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 58752 ;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 2, ADDITIONAL: 3 ;; QUESTION SECTION: ;enti.centropaghe.it. IN ANY ;; ANSWER SECTION: enti.centropaghe.it. 8342 IN MX 10 mail.enti.centropaghe.it. enti.centropaghe.it. 7266 IN A 213.178.198.58 ;; AUTHORITY SECTION: centropaghe.it. 71295 IN NS dns2.telemar.it. centropaghe.it. 71295 IN NS dns.telemar.it. ;; ADDITIONAL SECTION: mail.enti.centropaghe.it. 7294 IN A 213.178.198.62 dns.telemar.it. 28556 IN A 213.178.196.1 dns2.telemar.it. 20115 IN A 213.178.195.254 ;; Query time: 0 msec ;; SERVER: 192.168.1.221#53(192.168.1.221) ;; WHEN: Wed Feb 29 15:25:27 2012 ;; MSG SIZE rcvd: 167
Feb 29 17:11:10 darwin postfix/smtpd[8207]: warning: 213.178.xxx.xxx: hostname ip.213.178.xxx.xxx.telemar.it verification failed: Name or service not known Feb 29 17:11:10 darwin postfix/smtpd[8207]: connect from unknown[213.178.xxx.xxx] Feb 29 17:11:10 darwin postfix/smtpd[8207]: NOQUEUE: reject: RCPT from unknown[213.178.xxx.xxx]: 554 5.7.1 <[email protected]>: Relay access denied; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<[192.168.1.138]> Feb 29 17:11:13 darwin postfix/smtpd[8207]: disconnect from unknown[213.178.xxx.xxx]
alias_database = hash:/etc/aliases alias_maps = hash:/etc/aliases append_dot_mydomain = no biff = no config_directory = /etc/postfix inet_interfaces = all mail_spool_directory = /var/mail/ mailbox_size_limit = 0 mydestination = $myhostname, localhost.$mydomain, $mydomain, localhost mydomain = enti.centropaghe.it myhostname = mail.enti.centropaghe.it mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 192.168.1.0/24 myorigin = $mydomain readme_directory = no recipient_delimiter = + smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu) smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache smtpd_use_tls = yes
我希望就是这样。 如果你需要别的东西,让我知道。
最后修改,现在使用smtp的内部IP地址,我可以发送电子邮件到外面的地址。 但是不能使用mail.enti.centropaghe.it
从你的main.cf:
default_transport(默认:smtp)你用过: default_transport =错误
不匹配$ mydestination,$ inet_interfaces,$ proxy_interfaces,$ virtual_alias_domains,$ virtual_mailbox_domains或$ relay_domains的目标的默认邮件传递传输和下一跳目标
那么,就是这样。 删除这一行。 您希望使用SMTP发送不适合您的域名的电子邮件。 现在,你已经强迫自己只执行本地交付(任何应该去机器外的任何邮件将不被接受)。 这就是为什么你可以接收邮件,但没有任何不被该主机接受的东西被转发。
relayhost(默认:空)你用过: relayhost = $ mydomain
非本地邮件的下一跳目的地; 覆盖收件人地址中的非本地域。 这个信息被relay_transport推翻
这肯定会影响到事情。 除非您有一个不同的SMTP服务器在enti.centropaghe.it上监听您希望所有邮件都通过,否则您的邮件再次无处可去。 你可能应该删除这一行。
relay_transport(默认:relay)你用过: relay_transport =错误
用于远程传送到使用$ relay_domains列出的域的默认邮件传送传送和下一个传送目的地。 为了降低优先级,nexthop目标取自$ relay_transport,$ sender_dependent_relayhost_maps,$ relayhost或从收件人域
我看不到$ relay_domains,所以我build议删除这个。
啊,不同颜色的马 下面这一行说明谁可以接力。 您的错误消息来自以213.178开头的主机。 由于没有条目,所以你有其他forms的中继authentication,它被拒绝。 也许你想添加一个涵盖你指定的networking范围的条目?
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 192.168.1.0/24
让我知道这是如何解决你的。