Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Postfix - Disable Local Delivery Lookup?

2,160 views
Skip to first unread message

dredge

unread,
Sep 30, 2008, 11:52:42 AM9/30/08
to
Hi Everyone,

We currently have a dedicated web server running PostFix. The only
thing we need Postfix to do on this server is send emails for PHP.

The problem is that we have our email accounts hosted with another
company (not on the server that runs Postfix) so every time that PHP
tries to send an email to an @mydomain.com address, Postfix attempts
to deliver it locally, which results in a failed delivery (because our
email is hosted with another company).

Is there a way to have PostFix deliver @mydomain.com email to the ip
address listed on our domain's MX Record (which points to the company
that hosts our email), instead of trying to deliver it locally?

Thank you in advance.

Karl

Bit Twister

unread,
Sep 30, 2008, 12:30:04 PM9/30/08
to
On Tue, 30 Sep 2008 08:52:42 -0700 (PDT), dredge wrote:
>
> Is there a way to have PostFix deliver @mydomain.com email to the ip
> address listed on our domain's MX Record (which points to the company
> that hosts our email), instead of trying to deliver it locally?

Have you looked on http://www.postfix.org/documentation.html

I would play around in:
Address rewriting
Virtual domain hosting

Chris Babcock

unread,
Sep 30, 2008, 1:03:15 PM9/30/08
to

> Is there a way to have PostFix deliver @mydomain.com email to the ip
> address listed on our domain's MX Record (which points to the company
> that hosts our email), instead of trying to deliver it locally?

http://www.postfix.org/postconf.5.html#myorigin
http://www.postfix.org/postconf.5.html#mydestination

myorigin = mydomain.com
mydestination = localhost

For this configuration, you do not want Postfix delivering mail to
your domain locally, so don't include it among the destinations to
deliver locally. You should probably also set up aliases for any
accounts on the system so that mail to root at localhost gets
forwarded to a real person. As long as your mail server for inbound
mail is on the same network, there are probably a couple ways to
configure it so that this internal mail doesn't travel over the
Internet.

Best,
Chris

--


Make a difference in the world and support more Diplomacy projects and
services then you can shake a dagger at, please read:

http://members.bluegoosenews.com/diplomacy/blog/2008/09/24/a_special_note_for_diplomacy_players
- or -
http://tinyurl.com/3wx6lb

Blue Goose is willing to give me $250 to support various services and
projects in the Diplomacy hobby. The blog post above will tell you why
they are doing this, what I will do with the money, and what you can do
to help me get it.

Martin Gregorie

unread,
Sep 30, 2008, 6:06:07 PM9/30/08
to
On Tue, 30 Sep 2008 08:52:42 -0700, dredge wrote:

> Is there a way to have PostFix deliver @mydomain.com email to the ip
> address listed on our domain's MX Record (which points to the company
> that hosts our email), instead of trying to deliver it locally?
>

I do exactly that within my LAN: I have a central copy of Postfix that
does all mail collection and distribution and 'slave' copies on the other
machines to send any mail these machines generate to the central Postfix.
This sounds a lot like what you're wanting to do:

Here's the salient points of my slave configuration:

main.cf
=======
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
inet_interfaces = localhost
inet_protocols = all
mydestination = $myhostname, localhost.$mydomain, localhost
mydomain = example.com
mynetworks = 192.168.7.0/24, 127.0.0.0/8
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases.postfix
relayhost = mailserver.othercompany.com
unknown_local_recipient_reject_code = 550

This is all pretty standard stuff. The critical bits are the host names,
mydomain and relayhost.

The slave hostnames are all fully qualified, e.g. they have the form
slavename.example.com

mydomain could be defaulted but I set it explicitly.

relayhost is the name of the mailserver that is to accept all mail from
the slave systems. I don't read ANY mail, such as logwatch reports,
locally on the slave machines but get it via the central Postfix server's
Dovecot server.

/etc/aliases on the slaves has the following lines added:
============
# Person who should get root's mail
root: myuser
myuser: mycent...@central.example.com

'myuser' is the login I normally use on the slave machine. This means
that root's mail is redirected to myuser, which in turn is redirected to
mycentraluser on the central Postfix host. In your case myuser would be
whewre you're running PHP.

HTH (provided its formatting isn't scrambled by Pan).


--
martin@ | Martin Gregorie
gregorie. | Essex, UK
org |

0 new messages