Postfix Connection timed out

Im using Virtualmin/Webmin, everything works just fine (thx to ronald), I can even receive mail, but it appears that port 25 is open for incoming connections but not for outgoing connections. If someone telnet onto my they could connect to my mail server, but if I telnet I get a timeout connections. Sending mail only works locally.

My domain name is, My nameserver/localhost is
After sending mail out, Ill get a message like this:

Mail headers
From: (Mail Delivery System)
Date: 30/06/2012 22:27
Subject: Undelivered Mail Returned to Sender

Message contents:
This is the mail system at host
I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.
For further assistance, please send mail to postmaster.
If you do so, please include this problem report. You can
delete your own text from the attached returned message.
The mail system

<>: connect to[]:25: Connection timed out

Failed delivery status
Final recipient:
Reason for failure: connect to[]:25:
Reporting mail server:

Note that incoming mail works fine the problem is sending mail.

Installing sSMTP

- sudo apt-get install ssmtp
- Edit the ssmtp config file : gksu gedit /etc/ssmtp/ssmtp.conf

Enter this in the file:

- Enter the email address of the person who will receive your email:


Now enter this:
Subject: Sent from a terminal!
Here is a email send from the terminal using ssmtp, please let me know if you get it. Thx

To send the email: Ctrl + D

The problem with this is that installing SSMTP, removed some of the Postfix files and then the server just keep sending error mail like in a loop, every minute or so. Here is the email.
Cron <root@ns1> /etc/webmin/virtual-server/
to root
Error: Failed to query Postfix config command to get the current value of parameter queue_directory: sh: /usr/sbin/postconf: not found
and I have no idea what that means.

Cant remember what went wrong with this, but obviously this didn’t help ether. (i will post why as soon as I remembers lol)

Here are some instructions I found on the net to relay mail through gmail in Ubuntu but modify to for Webmin. The only confusing part was that the original instructions ask to edit the ‘generic’ table, but in Webmin/Postfix that 'generic, table is called ‘virtual’ table.

  • This assumes the user has webmin and Postfix installed and you understands how to log in and use it. (Usually bring it up in a browser at https://localhost:10000 )

  • You may want to install “mailutils” to test the mail system out: sudo apt-get install postfix mailutils or (sudo apt-get install mailutils)

  • If Postfix was already installed, then make sure it is installed as an SMTP (not local) mail server. That appears to be the default installed from Webmin.

  • Type the command line: sudo dpkg-reconfigure postfix

  • Selected: internet Site - Enter

  • Site name: - ok

  • Mail for postmaster and root - /etc/aliases

  • List of domains -

  • Force synchronous updates on Mail queue - no

  • Network Blocks - untouch

  • Use procmail for local delivery - if yes, you need to setup aliases that forwards mail for root to a real user. - yes

  • Mailbox size limit - 0

  • Local address extension character - +

  • Internet protocols to use - ipv4
    sudo /etc/init.d/postfix reload

  • In Webmin click on “Servers”, “Postfix Mail Server”, “SMTP Authentication And Encryption”.

  • Enter "[]:587 in the “Send outgoing email via host” entry box.

  • Check “Login as” and enter your Gmail user name and password.

  • Click on Save and Apply

  • Return to Postfix main page and click on “Virtual Domains”. Add a lookup table by clicking on the “…” next to “Map specifications”.

note: here goes the confusing part. The instructions mention: /etc/postfix/generic but what shows there is: /etc/postfix/virtual …So I think just create a new table for /etc/postfix/generic and leave /etc/postfix/virtual along just in case.

  • Check and enter a “Mapping file” of “/etc/postfix/generic”, then click “Save”. Click “Save and Apply”.

Note: I added a Map source 2, clicked on Mapping file: and there I typed /etc/postfix/generic

  • Now go to the “Virtual Domains” page again and click “Add a new mapping.”.
  • Enter the local address to remote address mapping, for example “root@localhost” to “”. An entry should be added for each user that is expected to send mail.
  • Click on “Edit Config Files”. It should be editing “/etc/postfix/” by default.
  • Add this line (the line inside the parentesis) above: smtp_sasl_password_maps=… (smtp_sasl_auth_enable=yes)
  • Add this to the bottom of the “” file and click “Save” (make sure there is a new-line at the end):
client TLS parameters

smtp_sasl_security_options = noanonymous
smtp_generic_maps = hash:/etc/postfix/generic

  • The easiest way to test sending email is to use the ‘mail’ program:
    echo “test” | mail -s ‘Test 1’
  • Then check the logs to see if it bounced or had a problem:
    tail /var/log/mail.log

Without going into what you have tried with the mailserver, I believe it has to do with port 25.
You have a router and behind it a laptop. On a second drive you have installed ubuntu server.

The incoming connection can be established. The outgoing connection is being blocked somehow.
Your ISP claims it doesn’t block port 25, but they use a different port for mail.

Your ISP is Verizon and they actually do block port 25 since 2009.

Your port 25 will be open if you upgrade your account to have a static IP

Still no luck with my email server sending email outside the server. Dont know what to do next.


Well, you mentioned this as your error:

: connect to[]:25: Connection timed out

There’s nothing in Virtualmin that blocks outgoing connections… the only reasons that would occur are:

  1. A firewall blocking outgoing connections was added to your server

  2. Some piece of hardware in front of your server is blocking those connections

  3. Your ISP is blocking those connections

  4. The mail server itself is not accepting the connections

I suspect you’d know if it was #1, as that means you added a firewall to your own system… though you could verify that by running “iptables -L -n” and reviewing the output.

It’s unlikely to be #4, since it sounds like you’re saying it happens with all mail servers.

It’s very likely an issue with your ISP… though it’s also possible it’s related to some other hardware device in front of your server.


Hi Eric, sorry I did not replay to this message, since I did not subscribed to the thread and did not know you have made a post.

Can you please make a subsection on something that will solve my problem please? I don’t know if ISP is blocking ports, they claim they are not.

Installing sSMTP kind of worked for me except that looks like i did some wrong cos, i was getting like some kind of loop/bounce mail to the server and my inbox was being full of the same email. Thx