LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-19-2006, 06:40 AM   #1
shawnbishop
Member
 
Registered: Dec 2005
Location: South Africa
Distribution: CentOS,Ubuntu,Fedora
Posts: 249

Rep: Reputation: 30
Postfix and local delivery


Good Day

Regarding Postfix and local Delivery I have a strange request. I dont want postfix to deliver mail locally, I want all mail to go out via the internet even if it is for a user on the local box.
Therefore if user1@company.com sends to user2@company.com it must go via the internet and ISP.

The reason I want to do this is that I use fetchmail to retrieve mail for some of the users from our ISP, that are based locally, but some of the users are based remotly, even though they have the same @companyname.com address.

Thanks in advance Shawn
 
Old 10-19-2006, 07:08 AM   #2
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
You can probably dor it either through mailbox_command_maps or transport_maps. Have a look at postfix.org
 
Old 10-19-2006, 07:14 AM   #3
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
well i assume you'd simply not set the $mydomain variables so it didn't class anything as being local, and instead just relay anything from your trusted sources of destinations.

would it not be a better approach to look at letting your remote users use pop3 though? if your internet connectivity is as reliable as your ISP's (or near enough) then how do you benefit sending it all back to an isp?
 
Old 10-19-2006, 07:40 AM   #4
shawnbishop
Member
 
Registered: Dec 2005
Location: South Africa
Distribution: CentOS,Ubuntu,Fedora
Posts: 249

Original Poster
Rep: Reputation: 30
Hi

Thanks for the quick replies, basically this is how it is setup.

We have 10 users which have the user@company.com email address, they are all located at the HQ, we then have approximatly 50 users all over the country with the user@company.com address. These remote users use POP3 to download mail from the ISP (so that is fine), Now when the users inside HQ wanted to send mail to one of the users that was remote, it would give a "550 error user not found in local table" (or something like that), so we added all the remote users on the main server at the HQ, now when we send mail internally it goes to the local user on the server and the people that get their mail from the ISP don't receive it, because it is sitting on the local server.

SP how do I specify which users mail should stay on the local Server and which users mail should go to the ISP, even though their @company.com is the same??
 
Old 10-19-2006, 08:50 AM   #5
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
as much as i'm aware it's not what you're actually asking for, i really would suggest exploring serving pop3 from your own site directly. i can't see a downside to this and it massively simplifies things... is there a real reason you can't do this?
 
Old 10-19-2006, 09:25 AM   #6
shawnbishop
Member
 
Registered: Dec 2005
Location: South Africa
Distribution: CentOS,Ubuntu,Fedora
Posts: 249

Original Poster
Rep: Reputation: 30
Good Day

Well the main reason is I have a ADSL, which has a dynamic IP address.So the server uses fetchmail to collect the mail.
Also if I serve the POP3 I need a static IP address for all the users to connect to, as the company is a Non-Profit Organization they need to save $$$ where ever they can.(in South Africa Broadband is very expensive)

I have tried the DynDNS update service, to assign a domain to my dynamic IP address,but it causes problems and lags when the DNS is updated, can take up to 4 hours to show the correct DNS entries and therefore mail goes missing.

I some how need to send some mail internally, for the users that are at the HQ, and the rest needs to go to their POP mail boxes at the ISP even though they have the same @company.com address
 
Old 10-19-2006, 11:38 AM   #7
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
dynamic? how dynamic actually is it? if the router is online you should really see no change... i'd suggest trying an alternative service, maybe like zoneedit.com, they've been great for me, and updated really fast, although naturally it's out of their hands once a downstream dns decides to hold a cache. i'm sure there are other simple ways around the dynamicness though, if it's only for connectivity from certain clients.
 
Old 10-20-2006, 12:12 AM   #8
Berhanie
Senior Member
 
Registered: Dec 2003
Location: phnom penh
Distribution: Fedora
Posts: 1,625

Rep: Reputation: 165Reputation: 165
Quote:
Now when the users inside HQ wanted to send mail to one of the users that was remote, it would give a "550 error user not found in local table" (or something like that)
You can still have local users' mail delivered locally and the rest delivered offsite:
In main.cf:
Code:
mydestination = company.com $myhostname ...
fallback_transport = smtp:offsite.isp.com
 
Old 10-20-2006, 02:50 AM   #9
shawnbishop
Member
 
Registered: Dec 2005
Location: South Africa
Distribution: CentOS,Ubuntu,Fedora
Posts: 249

Original Poster
Rep: Reputation: 30
Good Day

I dont think I am being clear enough.I have 14 users that collect their mail from a local mail server that uses fetchmail to go and fetch the mail from an ISP.
The other 50 users go directly to the ISP to collect mail.(these other 50 users are situated around the country).All these users all 64 of them have the same email address eg, shawn@company.com

Now when the users at the HQ (14 users ) send to one of the other external users I get this error

Oct 20 09:35:15 UPCSAMAIL postfix/smtpd[6305]: NOQUEUE: reject: RCPT from unknown[192.168.0.45]: 550 <mailadmin@presbyterian.org.za>: Recipient address rejected: User unknown in local recipient table; from=<itadmin@presbyterian.org.za> to=<mailadmin@presbyterian.org.za> proto=SMTP helo=<BACKUPSERVER>
Oct 20 09:35:15 UPCSAMAIL postfix/smtpd[6305]: disconnect from unknown[192.168.0.45]

That is because the user is not on the local Server.I need postfix to ignore this and send the mail out anyway and not look at a local user.Or look at local users, and if it isnt present in a table of some sort, send the mail out via the Internet.
That way the mail will be delivered to the mailbox on the ISP server.

By the way my hostname is UPCSA.presbyterian.org.za
this is defined by $hostname and my $domain is presbyterian.org.za

Regards

Shawn

Last edited by shawnbishop; 10-20-2006 at 03:46 AM.
 
Old 10-20-2006, 04:58 AM   #10
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Sounds to me like Berhanie does what you want. Note that you don't need a table of local users, because Postfix will automatically check the user file.

If I read that post correctly, local users' mail will be delivered directly to their inboxes without going via the isp/fetchmail, but non local users will go to the isp.

If not, try something like

transport_maps = hash:/etc/postfix/transport

in main.cf

and

in transport_maps, have

example.com smtp:mail.at.your.isp


where your domain is example.com and your ips's mail server is mail.at.your.isp

Have a look at

man transport

Last edited by billymayday; 10-20-2006 at 05:05 AM.
 
Old 10-20-2006, 08:47 AM   #11
Berhanie
Senior Member
 
Registered: Dec 2003
Location: phnom penh
Distribution: Fedora
Posts: 1,625

Rep: Reputation: 165Reputation: 165
Code:
$ man 5 postconf
...
fallback_transport (default: empty)
       Optional message  delivery  transport  that  the  local(8)
       delivery  agent should use for names that are not found in
       the aliases(5) or UNIX password database.
...
I forgot this part earlier:
In main.cf:
Code:
local_recipient_maps = proxy:unix:passwd.byname $alias_maps
  hash:/etc/postfix/remote_users
And, in remote_users:
Code:
# Mail to these users is delivered outside
user1       #dummy value
user2       #dummy value
...

Last edited by Berhanie; 10-20-2006 at 10:39 AM.
 
Old 10-20-2006, 03:42 PM   #12
WindowBreaker
Member
 
Registered: Oct 2005
Distribution: Slackware
Posts: 228

Rep: Reputation: 40
Answer:

Step1:
Make sure your domain (ie: example.com) is NOT listed in the "mydestination" parameter.

To view what it is currently set to.
Code:
postconf mydestination
To reset it to the default value (ie: do this).
Code:
postconf -e "mydestination = $myhostname localhost.$mydomain localhost"
Step2:
Make sure that your domain (ie: example.com) is listed as a relay domain. This means that Postfix will accept the responsibility to deliver this email, but instead of delivering it locally, it will forward it to another mail host (ie: your ISP's MX host). The magic parameter here is "relay_domains".

To view what it is currently set to.
Code:
postconf relay_domains
To set it to example.com:
Code:
postconf -e "relay_domains = example.com"
Step3:
Make sure Postfix knows which host to forward email to. The magic parameter here is "relay_transport".

To view what it is currently set to.
Code:
postconf relay_transport
To set it to your ISP's email server (ie:mx1.isp.com):
Code:
postconf -e "relay_transport = smtp:[mx1.isp.com]"
NOTE: The reason I put the hostname of your ISP's email server in [] brackets is to avoid an MX DNS lookup. In other words, since you already know the hostname of your ISP's email server, we don't want Postfix to do a DNS query everytime.

Step4:
Once you did this, make sure you don't have any overriding settings in your "transport_maps" file. This is an optional parameter (ie: not set by default), and I'd recommend unsetting it for now, to make sure mail is redirected elsewhere.

To view what it is currently set to.
Code:
postconf transport_maps
To set it back to the default value:
Code:
postconf -e "transport_maps = "
Step5:
Now that everything is set, refresh Postfix with
Code:
postfix reload
Or if it's not running, start it with
Code:
postfix start

Last edited by WindowBreaker; 10-20-2006 at 03:44 PM.
 
1 members found this post helpful.
Old 10-23-2006, 02:42 AM   #13
shawnbishop
Member
 
Registered: Dec 2005
Location: South Africa
Distribution: CentOS,Ubuntu,Fedora
Posts: 249

Original Poster
Rep: Reputation: 30
Hi Window Breaker

With your setup, the local users email leaves the building, so if the ADSL line is unplugged the local users dont get email as well, so not what I was looking for.

Cheers
 
Old 10-23-2006, 04:40 AM   #14
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
If you want a simple, albeit inelegant solution, you could always just set up aliases for the offsite users like:

offsite_user1: offsite_user1@your.isp

I do think your solution is to use a transport map as I mentioned many posts ago though

Last edited by billymayday; 10-23-2006 at 05:24 AM.
 
Old 10-23-2006, 05:23 AM   #15
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Have a look at

http://www.postfix.org/transport.5.html
 
  


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
Exim4 only local delivery ALInux Linux - Networking 0 05-02-2006 09:06 AM
qmail local delivery lag branden_burger Linux - Networking 0 01-20-2006 04:14 AM
exim4: fetchmail and local delivery thw Linux - Networking 3 07-16-2005 04:54 PM
Sendmail local delivery watchamaka Linux - Networking 6 12-13-2003 01:32 PM
sendmail local delivery problems jhildebrand Linux - Networking 0 04-24-2003 03:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:18 PM.

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