After getting outgoing email to work on my linux box in order to email logs to myself (see  Sendmail1 , Sendmail2, Sendmail3 posts), i decided to try to get incoming email to the linux box to work. FYI This is not my main mail server, i basically use sendmail to send backup log files to other computers..

BTW here’s the OS for my box. it might be a slightly different config on other boxes:

#lsb_release -a

Distributor ID: RedHatEnterpriseES
Description:    Red Hat Enterprise Linux ES release 4 (Nahant Update 4)
Release:        4

I was getting the following error when trying to send an email

Oct 12 09:26:22 mylinuxbox sendmail[3959]: o9CDQM6f003957: to=, delay=00:00:00, xdelay=00:00:00, mailer=esmtp, pri=120321, relay=mylinuxbox.mydomain.com. [192.168.1.3], dsn=4.0.0, stat=Deferred: Connection refused by mylinuxbox.mydomain.com.

To test locally I used the command:
/usr/sbin/sendmail root@mylinuxbox.mydomain.com

to test remotely i used the command and it was successful:
telnet mylinuxbox.mydomain.com 25

220 mylinuxbox.mydomain.com ESMTP Sendmail 8.13.1/8.13.1; Tue, 12 Oct 2010 10:30:40 -0400

After doing a little research on this i was able to get it to work, by going into the /etc/mail/sendmail.cf file and adding the line (in bold). This allowed sendmail to listen on its ethernet port (192.168.1.3) in addition to localhost :

# SMTP daemon options

O DaemonPortOptions=Port=smtp,Addr=127.0.0.1, Name=MTA
O DaemonPortOptions=Port=smtp,Addr=192.168.1.3, Name=MTA

I then restarted sendmail (#service sendmail restart), performed the test again and everything worked correctly locally, however when i try to connect from my computer on port 25 I would get a connection refused.
C:\Users\me>telnet 192.168.1.3 25
Connecting To 192.168.1.3…Could not open connection to the host, on port 25: Connect failed

However, I realized that if i tried from my my mail server I could connect with no problems. Then i figured out that i had Mcafee Antivirus on my computer, and sure enough it was blocking me from making remote telnet connections to 25. duh.

Advertisements