我一直在尝试设置运行postfix的debian邮件服务器,但是当我尝试通过邮件example@outlook.com发送邮件时,收件人将发件人视为hostname.domain.com.它发送的主机名没有设置A或MX记录,它只是/ etc / hostname.如果我通过telnet localhost 25登录,我可以手动将发件人设置为admin@mydomain.com.
我的main.cf
myorigin = mydomian.com myhostname = mail.mydomain.com mydestination = mail.mydomain.com,mydomain.com,localhost,localhost.localdomain relayhost = mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 mailBox_size_limit = 0 recipient_delimiter = + inet_interfaces = all alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases smtpd_tls_cert_file=/etc/ssl/certs/mailcert.pem smtpd_tls_key_file=/etc/ssl/private/mail.key smtpd_use_tls=yes smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache smtpd_tls_security_level=may smtpd_tls_protocols = !SSLv2,!SSLv3 local_recipient_maps = proxy:unix:passwd.byname $alias_maps
Aug 3 06:28:51 hostname postfix/pickup[7047]: 4D5432023A: uid=1000 from=<user@hostname> Aug 3 06:28:51 hostname postfix/cleanup[7065]: 4D5432023A: message-id=<20140803042851.4D5432023A@mail.mydomain.com> Aug 3 06:28:51 hostname postfix/qmgr[7048]: 4D5432023A: from=<user@hostname.mydomain.com>,size=339,nrcpt=1 (queue active) Aug 3 06:28:52 hostname postfix/smtp[7067]: 4D5432023A: to=<destination@destinationserver.com>,relay=mail.destinationserver.com[IP]:25,delay=1.4,delays=0.11/0.01/0.49/0.78,dsn=2.0.0,status=sent (250 Queued (0.110 seconds)) Aug 3 06:28:52 hostname postfix/qmgr[7048]: 4D5432023A: removed
我尝试过设置masquerade_domains = mydomain.com,但是当我这样做时,它会在thunderbird和gmail中被标记为垃圾邮件.
来自我的服务器发送的消息的标头:
Return-Path: user@hostname.mydomain.com Received: from mail.mydomain.com (DESTINATION [127.0.0.1]) by mail.destination.com ; Sun,3 Aug 2014 08:10:06 +0200 Received: by mail.mydomain.com (Postfix,from userid 1000) id 6D7A68033A; Sun,3 Aug 2014 08:10:27 +0200 (CEST) To: <destination@outlook.com> Subject: test X-Mailer: mail (GNU Mailutils 2.99.97) Message-Id: <20140803061027.6D7A68033A@mail.mydomain.com> Date: Sun,3 Aug 2014 08:10:27 +0200 (CEST) From: user@hostname.mydomain.com fdsa
解决方法
在debian上,使用的默认发件人域由/ etc / mailname指定. AFAIK这是一个
Debian specific modification到postfix.
所以应该通过使用mydomain.com填充/ etc / mailname来解决.并且postfix中的myorigin在debian上默认为/ etc / mailname,这也应该在我看来使用(所以只需删除这一行).