Postfix able to receive email but not able to send it

Posted by c0mrade on Server Fault See other posts from Server Fault or by c0mrade
Published on 2012-11-23T19:32:41Z Indexed on 2012/11/23 23:06 UTC
Read the original article Hit count: 350

Filed under:
|
|

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 [email protected].

So I tested that and tried to send email to [email protected] 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

© Server Fault or respective owner

Related posts about centos

Related posts about postfix