Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 example.com . 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 = example.com
myhostname = mail.example.com
mynetworks = 127.0.0.0/8
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 ant@example.com.

So I tested that and tried to send email to ant@example.com 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: mail.example.com, port: 25; nested exception is: java.net.ConnectException: Connection timed out: connect 

What am I missing here?

Edit

I'm able to telnet to localhost :

Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 mail.example.com ESMTP Postfix
share|improve this question

2 Answers 2

up vote 0 down vote accepted

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

Look at the output of:

iptables-save
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 mail.example.com must resolve to 127.0.0.1 or you must add the IP for mail.example.com 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

 
discard

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.