Centos – 554 5.7.1 : Relay access denied centos postfix

centospostfixsmtp

I have problem in send mail from postfix in centos

I have following setup mail server postfix for sending mail but I am getting error.

As in the link I tried following commands

telnet localhost smtp

Trying ::1...
Connected to localhost.
Escape character is '^]'.
220 mydomain.com ESMTP Postfix
ehlo localhost
250-mydomain.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from:<domain.com>
250 2.1.0 Ok
rcpt to:<test@gmail.com>
554 5.7.1 <test@gmail.com>: Relay access denied

Edit-1

In terminal this works

echo TEST | mail -v -s "Test mail" testing@gmail.com

my postconf -n shows belog information

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
home_mailbox = Maildir/
html_directory = no
inet_interfaces = localhost
inet_protocols = all
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
mydomain = dummy.com
myhostname = dummy.com
mynetworks = all
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
sample_directory = /usr/share/doc/postfix-2.6.6/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
unknown_local_recipient_reject_code = 550

What configuration I have to perform to send mails from my server.

Best Answer

Based on the Postfix documentation, setting mynetworks = all doesn't appear to be valid, and if you specifically set mynetworks to something, then mynetworks_style is ignored.

Reset mynetworks back to its default value if you want to use mynetworks_style=host, or explicitly set mynetworks to reflect where mail is being sent from (usually localhost and your local subnet). For example:

mynetworks = 127.0.0.0/8 192.168.1.0/24
mynetworks_style = subnet