smtp receive email

2

2

i am trying to set up email on my debian wheezy box. i can telnet to localhost on it like so:

$ 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.

so this means i can send emails as localhost right? but i also want to receive them.

when i try to telnet to port 25 from my other pc on my own lan then it says:

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

also, nmap shows port 25 is closed to other machines on my lan:

$ 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

how can i get port 25 open so i can receive emails?

i have read that installing postfix may do the trick. however i would like to keep my system as minimal as possible. is it possible to receive emails only using the smtp server?

mulllhausen

Posted 2012-08-25T13:32:46.707

Reputation: 460

Answers

2

Start by checking to see what ip addresses / interfaces are listening for SMTP. (netstat -na)

This would show that sendmail is only listening on the loopback and not your 192.168.111.111 interfaces.

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

You will need to edit /etc/mail/sendmail.mc , look for ....

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

and replace the localhost ip with 192.168.111.111

run make sendmail.cf to update the config, and restart the service... also check out this link -> http://linux.3dn.nl/running-sendmail-on-debian/

If after you have done all of that, don't forget to check your firewalls/iptables ;)

HTH
Nick

Nick

Posted 2012-08-25T13:32:46.707

Reputation: 156

IS this still relevant, it doesn't seem correct to go meddling in sendmail.cf if my server uses exim – Stevie G – 2016-03-24T13:32:04.820

that works great thanks! i was actually just using 192.168.111.111 for testing but i need to contact the box from the internet so i used ip address 0.0.0.0 in /etc/mail/sendmail.mc to allow emails from anyone. – mulllhausen – 2012-08-25T14:57:26.507