Can’t send or receive email with Postfix (times out)

dovecotpostfixsmtp

I'm using Postfix and Dovecot on Debian Wheezy for sending and receiving emails. Dovecot seems to work just fine; I can connect, retrieve, move around, delete, etc., emails that already existed in the account (from past cron jobs). Postfix doesn't seem to work correctly though. This is what happens:

  1. Send email from ian@mydomain.com using Thunderbird (also tried K9 on Android).
  2. The email seems to make it to the SMTP server okay. The message gets put in my Sent folder in IMAP.
  3. Nothing happens after this. The recipient never receives the email.

My error log:

Aug 19 18:12:26 debian postfix/smtp[17822]: 3F920CFC2B4: to=<[MY GMAIL USERNAME]@gmail.com>, relay=none, delay=1282, delays=1219/0.01/63/0, dsn=4.4.1, status=deferred (connect to alt2.gmail-smail-smtp-in.l.google.com[74.125.130.26]:25: Connection timed out)
Aug 19 18:14:56 debian postfix/qmgr[17804]: 3F920CFC2B4: from=<ian@[MYDOMAIN].com>, size=2701, nrcpt=1 (queue active)
Aug 19 18:14:56 debian postfix/smtp[17836]: connect to gmail-smtp-in.l.google.com[2607:f8b0:400e:c01::1a]:25: Network is unreachable
Aug 19 18:15:17 debian postfix/smtp[17836]: connect to gmail-smtp-in.l.google.com[173.194.79.26]:25: Connection timed out
Aug 19 18:15:38 debian postfix/smtp[17836]: connect to alt1.gmail-smtp-in.l.google.com[74.125.142.26]:25: Connection timed out
Aug 19 18:15:38 debian postfix/smtp[17836]: connect to alt1.gmail-smtp-in.l.google.com[2607:f8b0:400e:c01::1b]:25: Network is unreachable
Aug 19 18:15:38 debian postfix/smtp[17836]: connect to alt2.gmail-smtp-in.l.google.com[2607:f8b0:400e:c01::1b]:25: Network is unreachable

*edited out my domain and Gmail username.

I have a Comcast residential line (static IP), and my firewall isn't a problem, the ports are open.

I also cannot send email to my Postfix server. I've tried sending emails from my Gmail accounts to my domain, and I've also tried sending emails to myself from within my domain; neither works. There are no errors in the logs and no indication that emails were ever received.

I'm using STARTTLS on both Postfix and Dovecot (certs are self-signed). I used this guide for the most part.

Best Answer

The logs are self explanatory for outbound email, in your case email sent to gmail. Your mail server can't connect to Gmail's mail servers on port 25. You can simply verify this by telneting to Gmail's mail server from your mail server -

 telnet gmail-smtp-in.l.google.com. 25
 telnet alt1.gmail-smtp-in.l.google.com. 25
 telnet alt2.gmail-smtp-in.l.google.com. 25

Your dns is working, as your mail server was able to retrieve the MX records for gmail. I would presume Comcast is blocking outbound port 25 connections.