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

$ telnet localhost 25
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 []
HELO dfgsdfgsfgdfg
250 localhost.localdomain Hello localhost [], 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
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 (
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?


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

[nick@svr mail]$ netstat -na | grep 25
tcp        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 # 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=, Name=MTA')dnl

and replace the localhost ip with

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 ;)


  • that works great thanks! i was actually just using for testing but i need to contact the box from the internet so i used ip address in /etc/mail/sendmail.mc to allow emails from anyone. – mulllhausen Aug 25 '12 at 14:57
  • IS this still relevant, it doesn't seem correct to go meddling in sendmail.cf if my server uses exim – Stevie G Mar 24 '16 at 13:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.