0

I have PostFix set up and everything is working, except I can't send emails. Now I know most ISPs ports block port 25, as can be seen in this error log entry:

Jan  2 04:29:08 mail postfix/smtp[5835]: connect to gmail-smtp-in.l.google.com[74.125.134.27]:25: Connection timed out

but I know there are alternate ports, like 587. How do I change PostFix so that it tries to connect to gmail-smtp-in.l.google.com on port 587 instead of 25?

Ryan Rowe
  • 5
  • 1
  • 6
  • What does "most ports block port 25" mean ? – arkascha Jan 02 '13 at 09:42
  • `gmail-smtp-in.l.google.com` is definately reachable on port 25. So I suggest you find what is blocking the access in your case. Most likely it is a local networking issue on your side. Switching postfix to another port for _outgoing_ smtp traffic won't work, since the server at gmail does not listen on that port. – arkascha Jan 02 '13 at 09:44
  • @arkascha Sorry, fixed the mistake – Ryan Rowe Jan 02 '13 at 09:45
  • Great. Please add _how_ you fixed the issue or _what_ you did, so that others can learn from you when googling this question. – arkascha Jan 02 '13 at 09:46
  • No I mean I fixed the gramatical mistake in my question. I know that outgoing connections to port 25 are being blocked by my ISP. Short of calling them up and asking for port 25 to be opened, is there any way to change the outgoing smtp port or get around this? – Ryan Rowe Jan 02 '13 at 09:47
  • Hm? Certainly no ISP blocks port 25. Why should he? Why do you think so? – arkascha Jan 02 '13 at 09:49
  • Well for one: [this](http://www.postcastserver.com/help/Port_25_Blocking.aspx), my ISP is ATT, and two: `telnet gmail-smtp-in.l.google.com 25` times out – Ryan Rowe Jan 02 '13 at 09:51
  • The description about ISPs blocking port 25 is probably the most stupid thing I read this year (ok, it just started...). What the hell is _that_ meant to be good for? In effect it blocks all email communication, except when you use a web mailer. Every email client uses port 25, since smtp is the most widespread way to send an email. There is no way around it. So either bring that stupid ISP to stop that shit or switch to a sane one, I'd say. – arkascha Jan 02 '13 at 09:55
  • You cannot really work around that issue from your side. You have to connect to port 25 on gmail, since that is the port they listen to. Except when gmail offers communication via an SSL encrypted socket, that one obviously uses another port. Check the gmail documentation, gmail does _not_ listen on port 587 (at least not on that server). – arkascha Jan 02 '13 at 09:57
  • Actually you could work around that issue if you can setup some sort of tunnel or proxy. But you need a server for that, a server that is connected to the internet without that stupid blocking, so most likely not using your ISP. But the setup is more complex, error prone and makes things complex without need. I'd know what I would tell my ISP if he would start doing funny like blocking my email communication. – arkascha Jan 02 '13 at 10:03
  • @arkascha Hey thanks for all the help, post an answer and I'll accept it – Ryan Rowe Jan 02 '13 at 10:07

1 Answers1

0

This post explains you how to “Sending Mail using SMTP and PHP” using SMTP credentials. In this post will show you how to send email using Gmail’s SMTP server. You need to install two pear packages, Mail and SMTP. Code is quite [self-explanatory][3]. example ...

  • I doubt the OP want's to use php for sending emails, since aparently he has a postfix server setup. Apart from that: how does this help to get around port 25 being blocked? – arkascha Jan 02 '13 at 10:06
  • Or do you just want to suggest to use `smtp.googlemail.com` as server and contact port `465`? Then why not say so? Actually that port is raechable, so @RyanRowe you might want to give that a try and configure your postfix that way. – arkascha Jan 02 '13 at 10:09
  • @arkascha is there a way to configure postfix to use outgoing port 465? Doesn't that require SSL? – Ryan Rowe Jan 02 '13 at 10:11
  • @RyanRowe Yes and yes. But it is not that difficult. Check the documentation. – arkascha Jan 02 '13 at 10:12
  • Can you link me? Any time I try to search about changing the smtp port all I can find is about changing the incoming smtp port – Ryan Rowe Jan 02 '13 at 10:12
  • @RyanRowe Look for 'postfix outgoing smtp ssl': https://www.google.de/search?q=postfix+outgoing+smtp+ssl&ie=utf-8&oe=utf-8&rls=org.mozilla:en-US:official&client=firefox-a&channel=fflb&sei=RgjkUKvdBsXHtAaC14G4Ag&gbv=2 – arkascha Jan 02 '13 at 10:14
  • @arkascha haha exact same search [terms as me](https://www.google.com/search?q=postfix+outgoing+smtp+ssl&oq=postfix+outgoing+smtp+ssl&aqs=chrome.0.57j0j60l3j0.6686&sourceid=chrome&ie=UTF-8#q=postfix+outgoing+smtp+ssl&hl=en&safe=off&tbo=d&ei=LwjkUKy9O4nGqQGE6oHIAQ&start=10&sa=N&bav=on.2,or.r_gc.r_pw.r_qf.&bvm=bv.1355534169,d.aWM&fp=4923ca7c4da5ccfb&bpcl=40096503&biw=1440&bih=779) but I still can't find anything – Ryan Rowe Jan 02 '13 at 10:16
  • @RyanRowe The result is full of hits. For example at position 3: http://ubuntu-tutorials.com/2008/11/11/relaying-postfix-smtp-via-smtpgmailcom/ – arkascha Jan 02 '13 at 10:18
  • @arkascha yes but I would rather avoid relays. I guess I'll just call up my ISP tomorrow – Ryan Rowe Jan 02 '13 at 10:20
  • @RyanRowe You mean you don't want to use gmail as a mail relay but directly send email to the receptients smtp servers? _Say so in your question!_ And: you cannot switch such scheme to ssl, since it depends on the port the receiving server listens on. You cannot change that one. You do need a relay. – arkascha Jan 02 '13 at 10:21
  • @arkascha Well either way I have to use a relay now because I just realized its a $50 fee to get port 25 unblocked – Ryan Rowe Jan 02 '13 at 10:24
  • @RyanRowe As said: change your ISP. Such behaviour is not acceptable. Oh, and if you want to work an own server then it might be worth investing in a virtual server. That one is running inside a real computing center and has much better network performance anyway. Costs a few Euro a month. Try Alvotec. – arkascha Jan 02 '13 at 10:27
  • @arkascha well I followed that link you gave me to the letter, now I'm just getting `connect to smtp.gmail.com[2607:f8b0:4002:c04::6d]:587: Network is unreachable` – Ryan Rowe Jan 02 '13 at 10:29
  • @RyanRowe Wrong port. As said further up in this thread that server listens on port `465`, not `587`. The link I gave you was just to point out the configuration options. Always test _first_ if the server listens on a port and is reachable for you. Use `telnet smtp.gmail.com 465` for that. Saves a lot of hassle. – arkascha Jan 02 '13 at 10:35
  • @arkascha It has 587 in the tutorial, I didn't know if I should change it. I'll try changing it to 465. **Edit** Now this is just ridiculous, I changed it to 465 and I got this `connect to smtp.gmail.com[2607:f8b0:4002:c04::6d]:465: Network is unreachable` – Ryan Rowe Jan 02 '13 at 10:37
  • @RyanRowe Sorry, I cannot give you a word by word description what you should do. From someone trying to run servers I'd expect that he wants to and is able to understand what is required for that. You have to understand what you are doing, otherwise you will certainly run into problems later. So think what you want to do, then check how it can be done and do it. Don't try around or blindly type what someone tells you to. – arkascha Jan 02 '13 at 10:42