我正在尝试设置邮件服务器来接收电子邮件,我正在使用弹性 IP 的 Ubuntu EC2 实例上的 Postfix 和反向 DNS 查找指向我的域。
我可以在本地帐户之间发送和接收电子邮件,但无法接收外部电子邮件。
我已经设置了我的 MX 记录并且能够毫无问题地 telnet 到端口 25,但我仍然怀疑我的 MX 记录是否正确
A mail.example.in 123.123.3.11 (delete) 300 2010-10-12 03:37:24
A example.in 123.123.3.11 (delete) 300 2010-10-11 04:34:53
MX example.in mail.example.in (delete) 300 10 2010-10-12 02:03:03
A www.example.in 123.123.3.11 (delete) 300 2010-10-11 04:34:15
MX www.example.in mail.example.in (delete) 300 10 2010-10-12 02:12:51
Run Code Online (Sandbox Code Playgroud)
netstat -nl 给我
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:110 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:143 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:2000 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:993 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:995 0.0.0.0:* LISTEN
tcp6 0 0 :::22 :::* LISTEN
tcp6 0 0 :::25 :::* LISTEN
udp 0 0.0.0.0:68 0.0.0.0:*
Run Code Online (Sandbox Code Playgroud)
我的 /etc/postfix/main.cf 如下所示
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_tls_cert_file = /etc/ssl/certs/ssl-mail.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-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
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
myhostname = www.example.in
mydomain = example.in
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = $mydomain
mydestination = $myhostname,localhost.$mydomain, localhost, $mydomain
relayhost =
#mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mynetworks_style = host
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
local_recipient_maps =
virtual_alias_domains = www.example.in
virtual_alias_maps = hash:/etc/postfix/virtual
inet_protocols = all
home_mailbox = Maildir/
smtpd_sasl_auth_enable = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/dovecot-auth
smtpd_sasl_authenticated_header = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = reject_unknown_sender_domain, reject_unknown_recipient_domain, reject_unauth_pipelining, permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
smtpd_sender_restrictions = reject_unknown_sender_domain
mailbox_command = /usr/lib/dovecot/deliver -c /etc/dovecot/conf.d/01-dovecot-postfix.conf -n -m "${EXTENSION}"
smtp_use_tls = yes
smtpd_tls_received_header = yes
smtpd_tls_mandatory_protocols = SSLv3, TLSv1
smtpd_tls_mandatory_ciphers = medium
smtpd_tls_auth_only = yes
tls_random_source = dev:/dev/urandom
Run Code Online (Sandbox Code Playgroud)
看不到邮件实际到达我的服务器的日志,并且 /var/log/syslog 中没有详细信息
我确定我遗漏了一些基本的东西,并且想要一些关于如何设置它的帮助。
我在 /etc/postfix/virtual 中设置了一个 catch all id,它适用于本地电子邮件。我打算使用 ruby 处理传入的邮件,但我一直无法启动和运行它。
我的邮件不断收到以下消息
这是一个自动生成的传送状态通知 这仅是一个警告信息。 你不用重新发送你的讯息。 传递到下列收件人已被推迟: 消息将再重试 2 天 临时故障的技术细节: 接收服务器不接受我们的连接请求。如需了解详情,请访问 http://mail.google.com/support/bin/answer.py?answer=7720 [mail.example.in。(10):连接超时]
提前致谢
如果您可以通过 IP 从网络外部访问服务器,那么您的 MX 记录肯定有问题。谷歌搜索一个开放的中继测试器并将你的 IP 放在那里,看看它是否能够连接到服务器。
连接超时通常是由以下两种原因之一引起的:防火墙占用连接(可能在服务器本身或网络防火墙上)或 IP 地址错误并指向未使用的地址,在该地址中没有任何东西可以拒绝连接。请注意,如果您只是更改了 DNS 配置,根据您的 DNS 记录告诉每个人缓存查找结果的时间长短,他们可能仍在使用旧信息一段时间。
如果 IP 在您的网络外部工作,并且自您设置 DNS 缓存已更新以来已经足够长,那么在没有真实信息的情况下找出您的 MX 记录有什么问题并不容易。MX 记录的唯一规则是
1) MX 记录必须包含主机名(不是 IP)和
2)主机名必须有包含其 IP(不是 CNAME)的 A 记录
大多数邮件服务器识别完全无效的 MX 记录,并且弹出一条消息说这样的话。
你最好的选择是使用dig MX example.inwhich 应该产生类似的东西
;; ANSWER SECTION:
example.in. 6400 IN MX mail.example.in.
Run Code Online (Sandbox Code Playgroud)
然后,dig A mail.example.in应该说类似的话
;; ANSWER SECTION:
mail.example.in. 6400 IN A xxx.xxx.xxx.xxx
Run Code Online (Sandbox Code Playgroud)
我唯一能想到的另一件事是,在您粘贴的匿名示例 DNS 配置中,终止“。” 主机名中缺少 . ,但我不知道这是因为您的搜索和替换还是因为该粘贴来自某种网络编辑器,该编辑器可能对您隐藏了那些终止的“。”。您粘贴的退回邮件使用了“mail.example.in”。所以我怀疑它只是隐藏的。
如果 IP 在您的网络外部不起作用,那么您需要检查服务器防火墙(Linux 上的 iptables)以确保它没有阻止连接。如果您可以从网络中的另一台机器连接,那么该端口要么被您的网络防火墙/路由器阻止,要么您的 ISP 阻止了 SMTP。
此外,请确保您的弹性 IP 与您的实例正确关联。根据此处的文档,这看起来是一个非常复杂的操作:http : //developer.amazonwebservices.com/connect/entry.jspa? externalID= 1346