![当我发送这样的邮件时:](https://linux22.com/image/699030/%E5%BD%93%E6%88%91%E5%8F%91%E9%80%81%E8%BF%99%E6%A0%B7%E7%9A%84%E9%82%AE%E4%BB%B6%E6%97%B6%EF%BC%9A.png)
我正在尝试设置 posfix,以便我可以使用“免费”域名发送电子邮件http://freedns.afraid.org/。
我可以正常接收邮件,但发送则是另一回事...邮件反弹,状态为:5.0.0。
mynetworks 下列出的是 6.6.6.6,这是实际的服务器 IP...但主机提供商 (hetzner.de) 为系统添加了另一个可通过互联网访问的 IP (1.2.3.4)。
第一个不行。我无法为主机设置 MX 记录,但据我所知,这是不需要的。
这是向您展示发生了什么的信息,如果我错过了重要部分,请告诉我。
我替换了这些值:
服务器 ip:1.2.3.4
dns 名称:somedomainname.strangled.net
目标电子邮件:[电子邮件保护]
用户名:myuser
是的,myuser 是系统用户,也是目标/目标电子邮件的一部分。
当我发送这样的邮件时:
echo "This is the body" | mutt -s "Testing mutt" [email protected]
这显示在日志中
Feb 18 15:37:44 andromeda postfix/pickup[6781]: 1EE9FC05B3: uid=1000 from=<myuser>
Feb 18 15:37:44 andromeda postfix/cleanup[6920]: 1EE9FC05B3: message-id=<[email protected]>
Feb 18 15:37:44 andromeda postfix/qmgr[6134]: 1EE9FC05B3: from=<[email protected]>, size=477, nrcpt=1 (queue active)
Feb 18 15:37:44 andromeda postfix/error[6922]: 1EE9FC05B3: to=<[email protected]>, relay=none, delay=0.07, delays=0.05/0.01/0/0.02, dsn=5.0.0, status=bounced (mail.de)
Feb 18 15:37:44 andromeda postfix/cleanup[6920]: 2B2BAC090C: message-id=<[email protected]>
Feb 18 15:37:44 andromeda postfix/qmgr[6134]: 2B2BAC090C: from=<>, size=2360, nrcpt=1 (queue active)
Feb 18 15:37:44 andromeda postfix/bounce[6923]: 1EE9FC05B3: sender non-delivery notification: 2B2BAC090C
Feb 18 15:37:44 andromeda postfix/qmgr[6134]: 1EE9FC05B3: removed
Feb 18 15:37:44 andromeda postfix/local[6925]: 2B2BAC090C: to=<[email protected]>, relay=local, delay=0.03, delays=0.01/0.01/0/0.01, dsn=2.0.0, status=sent (delivered to command: procmail -a "$EXTENSION")
Feb 18 15:37:44 andromeda postfix/qmgr[6134]: 2B2BAC090C: removed
如您所见,这就是 mail.de 的回复:状态:5.0.0
[-- Attachment #2: Delivery report --]
[-- Type: message/delivery-status, Encoding: 7bit, Size: 0.3K --]
Reporting-MTA: dns; somedomainname.strangled.net
X-Postfix-Queue-ID: 1EE9FC05B3
X-Postfix-Sender: rfc822; [email protected]
Arrival-Date: Sat, 18 Feb 2017 15:37:44 +0100 (CET)
Final-Recipient: rfc822; [email protected]
Original-Recipient: rfc822;[email protected]
Action: failed
Status: 5.0.0
Diagnostic-Code: X-Postfix; mail.de
DNS 查找
dig somedomainname.strangled.net
; <<>> DiG 9.10.3-P4-Debian <<>> somedomainname.strangled.net
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 17662
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1460
;; QUESTION SECTION:
;somedomainname.strangled.net. IN A
;; ANSWER SECTION:
somedomainname.strangled.net. 3600 IN A 1.2.3.4
;; Query time: 176 msec
;; SERVER: 192.168.2.1#53(192.168.2.1)
;; WHEN: Sat Feb 18 15:42:20 CET 2017
;; MSG SIZE rcvd: 95
反向域名
dig -x 1.2.3.4
; <<>> DiG 9.10.3-P4-Debian <<>> -x 1.2.3.4
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 44643
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1460
;; QUESTION SECTION:
;4.3.2.1.in-addr.arpa. IN PTR
;; ANSWER SECTION:
4.3.2.1.in-addr.arpa. 43200 IN PTR somedomainname.strangled.net.
;; Query time: 41 msec
;; SERVER: 192.168.2.1#53(192.168.2.1)
;; WHEN: Sat Feb 18 15:44:44 CET 2017
;; MSG SIZE rcvd: 94
/etc/mailname:somedomainname.strangled.net
。
后配置-n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
bounce_notice_recipient = myuser@localhost
default_transport = error
home_mailbox = Maildir/
inet_interfaces = all
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
mydestination = ${myhostname} localhost.localdomain, localhost
mydomain = strangled.net
myhostname = mickeymouse.${mydomain}
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 6.6.6.6/32
myorigin = $myhostname
readme_directory = no
recipient_delimiter = +
relay_transport = error
relayhost =
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated defer_unauth_destination
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
virtual_alias_maps = hash:/etc/postfix/virtual
virtual_gid_maps = static:5000
virtual_mailbox_base = /home/vmail/
virtual_mailbox_domains = andromeda
virtual_mailbox_maps = hash:/etc/postfix/vmailbox
virtual_minimum_uid = 1000
virtual_uid_maps = static:5000
知道我错过了什么吗?
答案1
目标邮件服务器(对于 mail.de)选择不披露拒绝邮件的原因。该原因通常应出现在诊断代码行中,但在这里他们将其替换为垃圾邮件。
您可以猜测他们拒绝来自 freedns 托管域的邮件,这是合理的。但要 100% 确定拒绝的原因,您需要联系该域的邮件管理员,并希望他们选择告诉您拒绝的原因。
答案2
据我所知,配置应该可以工作,它使用一个“真实”域名,而不是 freedns 提供商的子域名。
正如 Jacob Evans 所说,真实域名确实有 SPF 记录。还有 MX 记录。