0

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
c0mrade
  • 81
  • 1
  • 11

2 Answers2

1

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.

mailq
  • 16,882
  • 2
  • 36
  • 66
  • 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
0

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

Look at the output of:

iptables-save
cstamas
  • 6,607
  • 24
  • 42
  • 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