Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I had postfix running on my machine(comes with centos minimal), but today I configured it to use my domain for the sake of example this is my domain name . Here is my config :

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
header_checks = regexp:/etc/postfix/header_checks
html_directory = no
inet_interfaces = all
inet_protocols = ipv4
mail_owner = postfix
mailbox_size_limit = 1073741824
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
message_size_limit = 10485760
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
mydomain =
myhostname =
mynetworks =
mynetworks_style = host
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
relayhost = smtp.$mydomain
sample_directory = /usr/share/doc/postfix-2.6.6/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtpd_banner = $myhostname ESMTP $mail_name
smtpd_client_restrictions = permit_mynetworks,reject_unknown_client,permit
smtpd_recipient_restrictions = permit_mynetworks,permit_auth_destination,permit_sasl_authenticated,reject
unknown_local_recipient_reject_code = 550

I need one email account to be able to send emails (password retrievals etc.). I read today somewhere that if you create unix account postfix will recognize it as email address so if your account username was ant your email would be

So I tested that and tried to send email to and I successfully received mail.

When I try to send the email with ant task script, I'm not able to connect :

Failed messages: javax.mail.MessagingException: Could not connect to SMTP host:, port: 25; nested exception is: Connection timed out: connect 

What am I missing here?


I'm able to telnet to localhost :

Connected to localhost.
Escape character is '^]'.
220 ESMTP Postfix
share|improve this question
up vote 0 down vote accepted

You have a firewall somewhere what is denying incoming connections to postfix.

Look at the output of:

share|improve this answer
hello it's disabled, and I think the message would be that connection is refused but it's timeout in my case don't really get why – c0mrade Nov 23 '12 at 20:05
if you have a firewall somewhere what is dropping packets you get "connection timeout" – cstamas Nov 23 '12 at 20:24

You are missing the DNS. Either must resolve to or you must add the IP for to mynetworks.

share|improve this answer
I am not sure if that is right. He is getting "connection timed out". Look at the java exception. – cstamas Nov 23 '12 at 21:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.