8

I get the following error trying to send an email to my Google Apps Email at [email protected] from my Postfix server.

to=, relay=local, delay=0.09, delays=0.07/0/0/0.02, dsn=5.1.1, status=bounced (unknown user: "admin")

Is there a way I can force it to not use the LOCAL relay and treat [email protected] as outside email and not look for a user in the current postfix configuration.

I am trying to email the full email address "[email protected]" not only "admin".

I have the Google Apps MX record on mydomain.com + SPF record which before was:

v=spf1 include:_spf.google.com ~all (emailing to [email protected] used to work with that record)

But I had to change it to v=spf1 a mx ip4:MY.IP.HERE include:_spf.google.com ~all

3 Answers 3

5

Yes you can. Don't use admin as the recipient. Use something that is "outside" like [email protected].

This only works if mydomain.com is not the domain configured in Postfix. Because Postfix thinks everything is local when you configured it to be local.

You should provide WAY more information than "it doesn't work". What are your configured domains, relay hosts, transport maps, MX records and the like?

6
  • I have only one configured domain "mydomain.com", no other fancy stuff that is not out of the box Postfix.
    – Ivo Sabev
    Aug 15, 2011 at 18:46
  • And there is the problem. You told "mydomain.com" belongs to Postfix. But then you want that domain to be outside. That does not fit.
    – mailq
    Aug 15, 2011 at 18:54
  • 1
    I am a bit confused on the matters related to postfix :) I fixed the issue by not setting the mydestination param in main.cf
    – Ivo Sabev
    Aug 15, 2011 at 19:00
  • Fine. That is what I proposed.
    – mailq
    Aug 15, 2011 at 19:04
  • 2
    Nothing more easy than that! Set it to myhostname = thehost.mydomain.com. That's why it is called myhostname and not mydomainname.
    – mailq
    Aug 15, 2011 at 19:09
11

Set the fallback_transport variable to relay , that way it'll send it to Google or whatever server it should, if doesn't find the user locally.

If you never want the mail to be sent to a local user change the mydestination variable to localhost , that way it'll only forward locally email addresses ending in .localhost

It would look like that in your main.cf file:

mydestination = localhost.localdomain, localhost
fallback_transport = relay
2
  • 1
    Would you literally type in 'localhost.localdomain, localhost'? Or would you substitute 'localdomain' with the actual domain?
    – pgunston
    Dec 10, 2014 at 1:39
  • @pgunston I believe you type "localhost" literally. The point being that "admin@localhost" would still get delivered to a local mailbox, but "[email protected]" would get relayed off the machine. Dec 12, 2016 at 10:25
0

It could simply be that within postfix's main.cf you have your target email domain listed. In this example we're going to assume the following:

  1. On this server you are hosting the example.com LAMP/LEMP website.
  2. That you have an online contact form (eg. php) which sends emails to [email protected] (from [email protected] to [email protected])
  3. That your example.com emails are actually on GSuite or some other service. Not on this server.

Symptoms: If you change the online form to send emails to your personal email [email protected] it works fine. But nothing arrives at your [email protected] inbox.

Remedy: Check to see if your email domain is listed under "mydestination" in the postfix config

grep mydestination /etc/postfix/main.cf
mydestination = $myhostname, example.com, my.actual.hostname, localhost
-----------------------------^^^^^^^^^^^--------------------------------

vi /etc/postfix/main.cf
# removed example.com
mydestination = $myhostname, my.actual.hostname, localhost

service postfix reload

That fixed it for me! Hope it helps you.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .