-1

I have a website where the domain uses an external mail server (defined by mail.mydomain.com and the MX record). An example email address is johndoe@mydomain.com. Whenever the server sends a notification email to this user, it gets bounced with a message such as:

to=, relay=local, delay=0.03, delays=0.02/0.01/0/0.01, dsn=5.1.1, status=bounced (unknown user: "johndoe")

because it thinks the destination is localhost instead of mail.mydomain.com. Will reconfiguring Postfix take care of this issue? If so, what directives specifically need to be changed/added? And if not, what is the best way to resolve this?

Edit - Added postconf -n output:

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
inet_interfaces = all
mailbox_size_limit = 0
mydestination = mydomain.com, localhost.localdomain, localhost
myhostname = mydomain.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter = +
relayhost = 
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes

Thanks.

modulaaron
  • 257
  • 1
  • 4
  • 11
  • Can you please post the output of `postconf -n` to get better help? – Khaled Dec 18 '10 at 07:55
  • Sure, thanks. postconf -n output added above. – modulaaron Dec 18 '10 at 20:55
  • Are you sending the mail into the MTA as well? This looks to me like the 'To' in the envelope is just 'johndoe' and not 'johndoe@mycompany.com'. Also, is 'johndoe' a local account on this machine -- it doesn't look to me that you're doing virtual delivery, so you need to ensure you have accounts for everyone on the box. – jharley Dec 19 '10 at 15:37
  • johndoe@mycompany.com is an email address located at mail.mycompany.com, a remote mail server. When I send mail to this address from the web server, the problem is that it looks for this user on the web server localhost instead of on the remote mail server. The web server is only used to send mail - never to receive mail. – modulaaron Dec 19 '10 at 22:11

2 Answers2

1

Problem solved by changing:

mydestination = mydomain.com, localhost.localdomain, localhost

to:

mydestination = www.mydomain.com, localhost.localdomain, localhost
modulaaron
  • 257
  • 1
  • 4
  • 11
0

Given this is viewed many time, the working answer works with static domains, but is confusing regarding postfix syntax.

For outgoing service where the e-mail is being sent to an address of the same domain as the hostname

mydestination = $myhostname, localhost.$mydomain, $mydomain

is the recommended configuration string.

However the above link does not take into allowance the case raised by the question. so say your server is named www.sporting.events, you would need to configure:

myhostname = www.sporting.events
mydomain = www.sporting.events

to get mails not relayed to local

Jerome
  • 175
  • 7