LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-30-2017, 01:33 PM   #1
anon076
LQ Newbie
 
Registered: Jan 2010
Posts: 16

Rep: Reputation: Disabled
Postfix how to prevent delivering to local


Hello
I have postfix setup as an MTA and it's only doing the sending.
It's set up to allow some hosts to relay emails to the outside world.

The hostname of the postfix, let's say is post.can.com
And there's a local user named john on this box
John's email john@can.com is hosted at google mail

The issue is that when the host tries to send mail to say john@can.com, instead of sending to John's google email, it sends locally.


Postfix Configuration:
Quote:
myhostname = post.can.com

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

mydomain = can.com

myorigin = can.com

Is there a way to make it prevent sending this locally and have it use the mx record for the domain so it can be sent to google mail?

I've tried removing $mydomain from mydestination but it would reject relaying from allowed hosts.
 
Old 04-01-2017, 08:37 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

I'm not a postfix expert, but I think it can be done using transport maps.
Add in main.cf (if not already there) the line:
Code:
transport_maps = hash:/etc/postfix/transport
Open/edit the file /etc/postfix/transport and use:
Code:
john@can.com smtp:[aspmx.l.google.com]
Of course you should use the appropriate google smtp server above. If you want this to happen for all your users, then omit the "john@" part.

An finally rebuild transport_maps and reload postfix:
Code:
postmap /etc/postfix/transport
postfix reload
 
1 members found this post helpful.
Old 04-02-2017, 08:37 PM   #3
anon076
LQ Newbie
 
Registered: Jan 2010
Posts: 16

Original Poster
Rep: Reputation: Disabled
That worked, thanks!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Prevent Postfix sending mail to local mailboxes in a virtual-host setup nap_blownapart Linux - Server 3 07-24-2012 06:00 AM
Postfix not delivering to dovecot for local users (delivering to default user mail) Awalsh Linux - Server 0 07-27-2009 11:13 AM
How to prevent spoofing from Postfix/local part nihal Linux - Security 9 05-06-2009 11:10 AM
How to prevent sendmail from delivering mail to other systems? CBMcArthur Linux - Server 4 08-05-2007 11:37 AM
POSTFIX not delivering? BxBoy Linux - Software 1 06-04-2003 03:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration