Different email addresses of same email server for sending and receiving
I am actually a fresher in terms of configuring an email server. Recently I configured a Postfix email server combining with dovecot and squirrelmail on AWS EC2 centos server, following this guide:
How to configure an email server
The problem I am facing is that, when I send an email using the mail server that I have configured on external emails like outlook, gmail etc. is sent using the following email address
But, I cannot send an email to the above-mentioned address using outlook or gmail because the sender shows me this error: Gmail Error Description
But once I send the email after modifying the above-mentioned email address to the following: [email protected], I receive an email on my configured email server. What I want is that both the sender and receiver email addresses should be: [email protected] Here are my DNS records for the domain: DNS
Below is my Postfix Master.cf File: '''
smtp inet n - n - - smtpd
587 inet n - n - - smtpd
submission inet n - n - - smtpd
-o syslog_name=postfix/submission
-o smtpd_sasl_auth_enable=yes
-o smtpd_recipient_restrictions=permit_sasl_authenticated,reject
-o milter_macro_daemon_name=ORIGINATING
smtps inet n - n - - smtpd
-o syslog_name=postfix/smtps
-o smtpd_sasl_auth_enable=yes
-o smtpd_recipient_restrictions=permit_sasl_authenticated,reject
-o milter_macro_daemon_name=ORIGINATING
pickup unix n - n 60 1 pickup
cleanup unix n - n - 0 cleanup
qmgr unix n - n 300 1 qmgr
tlsmgr unix - - n 1000? 1 tlsmgr
rewrite unix - - n - - trivial-rewrite
bounce unix - - n - 0 bounce
defer unix - - n - 0 bounce
trace unix - - n - 0 bounce
verify unix - - n - 1 verify
flush unix n - n 1000? 0 flush
proxymap unix - - n - - proxymap
proxywrite unix - - n - 1 proxymap
smtp unix - - n - - smtp
relay unix - - n - - smtp
showq unix n - n - - showq
error unix - - n - - error
retry unix - - n - - error
discard unix - - n - - discard
local unix - n n - - local
virtual unix - n n - - virtual
lmtp unix - - n - - lmtp
anvil unix - - n - 1 anvil
scache unix - - n - 1 scache
Below is my Postfix Main.cf
queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
mail_owner = postfix
unknown_local_recipient_reject_code = 550
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
debug_peer_level = 2
debugger_command =
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
ddd $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.10.1/samples
readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES
myhostname = mail.example.app
mydomain = example.app
myorigin = $mydomain
inet_interfaces = all
inet_protocols = all
mydestination = $myhostname, localhost, $mydomain
mynetworks = 127.0.0.0/8
relay_domains = $mydestination
home_mailbox = Maildir/
This is a DNS issue. You have a wrong a MX record, i.e. your domain example.app doensn't have an MX record (mail.example.app has an MX record instead, but it doesn't need it). Thus Gmail tries to direct mail to A record (as a fallback).
Add into example.app
zone the following record:
example.app. MX 10 mail.example.app.
(and remove the mail.example.app MX
, it does no harm, but it doesn't needed)
this will tell the world that mail for example.app domain is processed at mail.example.app and after obvious negative DNS caching timeout Gmail and others will deliver mail to your mail server.