smtp接收邮件

smtp接收邮件

我正在尝试在我的 debian wheezy box 上设置电子邮件。我可以像这样通过 telnet 连接到 localhost:

$ telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 localhost.localdomain ESMTP Sendmail 8.14.4/8.14.4/Debian-2.1; Sat, 25 Aug 2012 22:55:52 +0930; (No UCE/UBE) logging access from: localhost(OK)-localhost [127.0.0.1]
HELO dfgsdfgsfgdfg
250 localhost.localdomain Hello localhost [127.0.0.1], pleased to meet you
^]
telnet> quit
Connection closed.

所以这意味着我可以作为本地主机发送电子邮件,对吗?但我也想接收它们。

当我尝试从我自己的局域网上的另一台电脑 telnet 到端口 25 时,它显示:

$ telnet rpi 25
Trying 192.168.111.111...
telnet: Unable to connect to remote host: Connection refused

此外,nmap 显示端口 25 对我的局域网上的其他机器已关闭:

$ nmap rpi -p25

Starting Nmap 5.00 ( http://nmap.org ) at 2012-08-25 23:00 CST
Interesting ports on rpi (192.168.111.111):
PORT   STATE  SERVICE
25/tcp closed smtp

Nmap done: 1 IP address (1 host up) scanned in 0.15 seconds

我如何才能打开端口 25 以便接收电子邮件?

我读到安装 postfix 可能会有效果。但是我想尽可能保持我的系统精简。是否可以仅使用 smtp 服务器接收电子邮件?

答案1

首先检查哪些 IP 地址/接口正在监听 SMTP。(netstat -na

这表明 sendmail 只监听环回而不是 192.168.111.111 接口。

[nick@svr mail]$ netstat -na | grep 25
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      
[nick@svr mail]$

您需要编辑/etc/mail/sendmail.mc、查找....

dnl # The following causes sendmail to only listen on the IPv4 loopback address
dnl # 127.0.0.1 and not on any other network devices. Remove the loopback
dnl # address restriction to accept email from the internet or intranet.
dnl #
DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl

并将本地主机 ip 替换为 192.168.111.111

运行make sendmail.cf更新配置,然后重新启动服务...还请查看此链接->http://linux.3dn.nl/running-sendmail-on-debian/

完成所有操作后,别忘了检查防火墙/iptables;)

HTH
尼克

相关内容