# Sendmail not sending in UBUNTU



## cearlp (Nov 26, 2008)

I am having problems getting sendmail to work in Ubuntu.
I am using the php mail function to send an email but the message is never received. Sendmail seems to be having a problem.
The mail.log file indicates "mailer=relay, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]".
My Linux box is behind a router and in order to get it to connect to the 'wired network' I changed the /etc/hosts file to contain the IP address assigned by the router. Before doing this it was listed in the hosts file as 127.0.1.1 (yes 127.0.1.1 not 127.0.0.1) and it took several minutes before the connection was complete.
I hope you can make sense out of all this rambling.


----------



## lensman3 (Oct 19, 2007)

From a command prompt enter:

telnet 127.0.0.1 25

(this command will emulate a mail program or another sendmail). Do you get any reply? Type in "HELP". You should get all the commands that your sendmail program knows about. Then type in "EXIT" to quit the session. (Enter HELP and EXIT without the quotes).

If you get a reply then sendmail ON YOUR MACHINE IS WORKING correctly.

Now do a test to say "comcast.net" by entering "telnet comcast.net 25". Don't forget to enter the 25 which is the port that sendmail listens on. The default sendmail config is for a local host sendmail only delivery. To get your sendmail to talk to your provider will take a lot of extra work because the Ubuntu sendmail has been lobotomized to minimize spamming. If you can't get to "comcast.net" then your provider or first mile internet provider is blocking TCP/IP port 25. A lot of ISP's have a email blacklist and consequently only allow their sites to receive email from selected (and well know) sites.

Trying to send an email to your router is a waste of time because the router doesn't have a receiving sendmail daemon aboard (unless it is a Linux firewall with it's sendmail running).
Let us know what happens. (Please recall that the "telnet <target> 25" can be considered hacking).


----------

