Unable to connect to SMTP
I have been having a few issues with setting up email services. I followed this guide here:
I am able to connect via imaps and retrieve mail. However, I am having issues trying to send mail. I can telnet to localhost on port 25 from the server itself. But using my own remote client, I am unable to telnet to port 25.
I tried enabling smtps from postfix's master.cf, restarting it and trying port 465. I can connect to the port remotely, but it doesn't seem to work correctly still.
I have gone over the guide a couple times to make sure I didn't miss anything. I have been at this for hours, so I am sure it is just something really simple I am missing.
Thanks for your help
Post the output of (as root): netstat -anp | grep "LISTEN .*master"
What's your server's IP?
Can you telnet to your server's IP from the server on port 25?
Is your server running a firewall?
Does your local ISP block outbound port 25 except to its own mail servers?
> root@server:~# netstat -anp | grep "LISTEN .*master"
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 2592/master
Yes I can telnet locally:
> root@server:~# telnet localhost 25
Connected to localhost.
Escape character is '^]'.
220 server.mydomain.com ESMTP Postfix (Ubuntu)
221 2.0.0 Bye
Connection closed by foreign host.
I do not remember setting up a firewall. Although the default Ubuntu install may have.
Ohh, that is a possibility. I can't telnet from my client (remote) machine to any other server running smtp either. Although, I have never had an issue trying to get my mail client (Apples mail.app) to work with any mail server before.
Find another client to test with.
From my Linode:
$ telnet 184.108.40.206 25 Trying 220.127.116.11... Connected to 18.104.22.168. Escape character is '^]'. 220 server.sleepycode.com ESMTP Postfix (Ubuntu) ^] telnet> quit Connection closed.
Should I change the port? Could I possibly use 465 or 587 (I think its that)?
submission inet n - n - - smtpd
You can enable the same options you have on the smtp entry
by adding the like this:
service restart postfix
and test it by telnet localhost 587
I can get it to work via telnet, but I can't login. It wants me to do a starttls or similar. It is refusing the login command.
Thanks for all the help so far. It is greatly appreciated
I disabled submission and smtp, then enabled smtps (without the options below it). This seems to work.
I disabled submission and smtp
Without the smtp entry you will not be receiving any mail on this server - is that really what you want?
> then enabled smtps (without the options below it). This seems to work.
You should consider enabling those options and setting up your client to use SSL - it is generally not a great idea to be sending your login info through an unencrypted connection these days.
So, what is the idea of having "smtps" in my master.cf, if it isn't already being made with a secure connection of some sorts? That just seems like a false positive.
Other people sending mail to you will always try to connect on port 25, which is what the original "smtp" line enables, so unless you really know better you want to leave that in place all the time.
There is more to setting up SSL or TLS on the server though - you need a certificate for the server and postfix needs to know about it.