LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 10-18-2007, 10:02 AM   #1
dlublink
Member
 
Registered: Oct 2004
Location: Canada
Distribution: Ubuntu
Posts: 330

Rep: Reputation: 30
Postfix special virtual domain


Hello,

I have a special virtual domain my postfix which is @special.mydomain.tld.

I would like any emails to that address to be sent to a command and as the first parameter of the email have the username from before @special or the entire username@special.mydomain.tld.

Trouble is this:

I setup in virtual like so:

@special.mydomain.tld : special@mydomain.tld

and in alias

special@mydomain.tld | /etc/postfix/mycommand

trouble is, the only way to recover is with the X-Original-To: header in the email, but it is not always correct.

Because I also have an alias on my server that points to a mailbox and an email on special@mydomain.tld, so when emails from from here X-Original-To contains the first email and not the email for special@mydomain.tld, so I am screwed.

Possibilities:

1. Execute the command directly from a virtual alias ( I can't figure out how to do this )
2. Perhaps something in master.cf could be configured for this? Use transport to deliver it?
3. ... other ideas?

Any ideas what to do or how to do one of the ideas I suggested?

edit:
I have done a bit of research and it would seem that having the code in master.cf is the best way to handle this. What I need to figure out is how to tell the virtual delivery to deliver @special.domain.tld to special in master and everything else to virtual as it does by default.


Thanks,

David

Last edited by dlublink; 10-18-2007 at 10:14 AM. Reason: new information from research
 
Old 10-18-2007, 10:40 AM   #2
dlublink
Member
 
Registered: Oct 2004
Location: Canada
Distribution: Ubuntu
Posts: 330

Original Poster
Rep: Reputation: 30
Problem solved, in master.cf I added:

special unix - n n - - pipe
flags=DRhu user=nobody argv=/etc/postfix/special ${recipient}

In /etc/postfix/transport I added:

special.lublink.net special

I ran postmap transport ( from the /etc/postfix directory)

In /etc/postfix/special (which is a php script ) :

#!/usr/bin/php
<?


$email = file_get_contents('php://stdin');

$destination = $argv[1];

// do something here.

?>
 
Old 10-18-2007, 01:12 PM   #3
dlublink
Member
 
Registered: Oct 2004
Location: Canada
Distribution: Ubuntu
Posts: 330

Original Poster
Rep: Reputation: 30
IMPORTANT NOTE!!!!

My server was rejecting emails to the domain listed, turns out that I need to have an account for each email address I want to accept on the domain. In my case I used a catch all since the domain is well hidden.

This is because postfix checks for the existance of the virtual domain, than the user (or domain catch all) than it delivers the message.

David
 
Old 10-18-2007, 01:16 PM   #4
dlublink
Member
 
Registered: Oct 2004
Location: Canada
Distribution: Ubuntu
Posts: 330

Original Poster
Rep: Reputation: 30
There is some related discussion here: http://www.linuxquestions.org/questi...=1#post2928716
 
  


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
Bounce selected users in virtual domain with Postfix? annekaelber Linux - Software 5 10-18-2007 01:58 PM
virtual domain & postfix jrafalek Linux - Software 1 02-05-2005 08:08 AM
postfix and virtual domain problems... MadOtis Linux - Software 1 04-28-2004 07:23 AM
Postfix virtual domain eyt Linux - Newbie 0 02-23-2004 05:07 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 02:01 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