Nexology Community
 
     
 
   

Go Back   Nexology Community > Support Zone > Plesk Control Panel

Reply
 
LinkBack Thread Tools Display Modes
Old 09-28-2009, 04:53 PM   #1
Registered User
 
Join Date: Oct 2005
Posts: 48
Question Creating Email Pipe with Plesk 9.2.2

Does anyone know how to setup plesk to pipe email to a script with postfix / plesk. Everything that I have found on the internet is for qmail.

I have a vps and am trying to learn more of the "simple" stuff to leave support for the "HARD" Stuff.

Thanks
Dillon
Dfishel is offline   Reply With Quote
Old 09-28-2009, 11:17 PM   #2
HN Top Canine
 
NexDog's Avatar
 
Join Date: Jan 2002
Location: The Nexus
Posts: 13,328
There is a solution. Can't remember offhand but will post when Pavel tells me.
__________________
Laurence - [HostNexus Administrator]

- Need Support? Quickest reponses are found at the Support Helpdesk!
- Stay in touch! Make sure you are subscribed to our Lists.
NexDog is offline   Reply With Quote
Old 09-29-2009, 04:34 AM   #3
HN Top Canine
 
NexDog's Avatar
 
Join Date: Jan 2002
Location: The Nexus
Posts: 13,328
I've rerwritten this post to make it clearer as the post ranks quite highly on Google for people searching how to create email pipes on Postfix. If you follow these steps it isn't actually that hard.

Each domain has its own entry in Postfix and you put all the pipes for one script in that file. If you have a weird program that uses different pipe scripts for different email addresses on teh same domain you will need to create separate Postfix files for them.

Okay so lets use Kayako (our support system) as an example. All addresses piped into the system use the same script, nice and simple. In this example my Postfix rule and script is "pipeDomainA".

Quote:
STEP 1
Open /etc/postfix/main.cf and at line transport_maps add the option: hash:/var/spool/postfix/plesk/pipeDomainA.

So the line will be after the edit:
transport_maps = hash:/var/spool/postfix/plesk/transport,
hash:/var/spool/postfix/plesk/pipeDomainA

You must add a transport map hash for each php pipe script on each domain.

So for example if i have 4 php scripts on 4 different domains the
transport_maps will be :

transport_maps = hash:/var/spool/postfix/plesk/transport,
hash:/var/spool/postfix/plesk/pipeDomainA, hash:/var/spool/postfix/plesk/pipeDomainB, hash:/var/spool/postfix/plesk/pipeDomainC, hash:/var/spool/postfix/plesk/pipeDomainD
Pretty simple. One file that you have to edit and add an entry for each domain needing a pipe. Now that's done let's actually create the file that we added as a path to the Postfix file above (/var/spool/postfix/plesk/pipeDomainA).

Quote:
Step 2

Create file /var/spool/postfix/plesk/pipes with your favourite editor and add all the addresses that needed piping into your program. For example:

sales@domain.com pipeDomainA:Sent to pipe
support@domain.com pipeDomainA:Sent to pipe
accounts@domain.com pipeDomainA:Sent to pipe
management@domain.com pipeDomainA:Sent to pipe

If you remember "pipeDomainA" is my Postfix rule entered in main.cf in Step 1. These rules just connect teh email address with pipe and teh last phrase is just a description for the maillog.
So not hard so far. We edited the Postfix main.cf with a path to a rule script and now created the rule script itself. Exciting stuff I know.

Quote:
Step 3

Now we must hash the transport file as pipeDomainA.db as postfix likes to work with database hashed files. To hash it simply type:

postmap /var/spool/postfix/plesk/pipeDomainA.
Now we've created a transport_map file and its contents and hashed it.

Quote:
Step 4

Now we must tell postfix which php script will execute this transport hash file named "pipeDomainA". For this edit /etc/postfix/master.cf and add a line after plesk_saslauthd:

pipeDomainA unix - n n - - pipe flags=Fq user=apache:apache
argv=/home/httpd/vhosts/domain.com/httpdocs/your-php-pipe-script.php
${sender}

Make sure you dont enter any spaces after "${sender}" or you will have
problems, Postfix is very sensitive with its master.cf file. So a windows
editor will corrupt it for sure. I use nano, simple but effective.
If you have other domains with other php pipe scripts then you add an entry in master.cf for each rule.

So for multiple scripts it would be:

pipeDomainA unix - n n - - pipe flags=Fq user=apache:apache
argv=/home/httpd/vhosts/domain1.com/httpdocs/your-php-pipe-script.php
${sender}

pipeDomainB unix - n n - - pipe flags=Fq user=apache:apache
argv=/home/httpd/vhosts/domain2.com/httpdocs/your-php-pipe-script.php
${sender}

So now we've entered a rule path in main.cf, we've created the rule script with email addresses, we've hashed it and now we've edited master.cf and told Postfix which rule goes with which script. One more step...

Quote:
Step 5

To finish up stop and start Postfix.
If everything was set correctly you should see in /usr/loca/psa/var/log/maillog "Sent to pipe" when you do tests.
__________________
Laurence - [HostNexus Administrator]

- Need Support? Quickest reponses are found at the Support Helpdesk!
- Stay in touch! Make sure you are subscribed to our Lists.

Last edited by NexDog; 10-06-2009 at 03:57 AM.
NexDog is offline   Reply With Quote
Old 09-29-2009, 07:43 AM   #4
Lost Soul
 
lharvey's Avatar
 
Join Date: Jun 2002
Location: Maine, USA
Posts: 1,223
OK Not to be totally ignorant. What is a pipe?

In English please.

Lee
__________________
I'm on Face Book
lharvey is offline   Reply With Quote
Old 09-29-2009, 08:07 AM   #5
HN Top Canine
 
NexDog's Avatar
 
Join Date: Jan 2002
Location: The Nexus
Posts: 13,328
It's a way to "pipe" email into a program. Like our support system. If you email support@ it creates a ticket. So the pipe takes your email and funnels it into a program and displays it there and does weird and wonderful things with it.
__________________
Laurence - [HostNexus Administrator]

- Need Support? Quickest reponses are found at the Support Helpdesk!
- Stay in touch! Make sure you are subscribed to our Lists.
NexDog is offline   Reply With Quote
Old 09-29-2009, 08:13 AM   #6
Lost Soul
 
lharvey's Avatar
 
Join Date: Jun 2002
Location: Maine, USA
Posts: 1,223
OK got it.

Don't need it but sounds like it could be handy for somethings.

Thanks Laurence.

L
__________________
I'm on Face Book
lharvey is offline   Reply With Quote
Old 09-30-2009, 07:12 AM   #7
You and what a
 
RobbieLePommie's Avatar
 
Join Date: Aug 2002
Location: Sydney
Posts: 5,928
The simpler option (even I baulked at those instructions, and I enjoy a challenge) it to have a script that reads a mailbox; you can read and delete from a mailbox through IMAP - PHP handles it quite well - and then set that to run on a cron job.

The entire program would be shorter than Laurence's instructions - but obviously it's not as streamlined once set up.

Oh, you don't need support to set it up.
__________________
Rob
----------------------------
For your information, there's a lot more to ogres than people think.
RobbieLePommie is offline   Reply With Quote
Old 09-30-2009, 11:25 AM   #8
Registered User
 
Join Date: Oct 2005
Posts: 48
Thank you, I can now se why you can't remember it off hand. and If you could I would run away scared.
Dfishel is offline   Reply With Quote
Old 09-30-2009, 11:26 AM   #9
Registered User
 
Join Date: Oct 2005
Posts: 48
Quote:
Originally Posted by RobbieLePommie View Post
The simpler option (even I baulked at those instructions, and I enjoy a challenge) it to have a script that reads a mailbox; you can read and delete from a mailbox through IMAP - PHP handles it quite well - and then set that to run on a cron job.

The entire program would be shorter than Laurence's instructions - but obviously it's not as streamlined once set up.

Oh, you don't need support to set it up.
My support system does this but one of the project managements systems that I was looking into only supports pipes.
Dfishel is offline   Reply With Quote
Old 10-06-2009, 03:58 AM   #10
HN Top Canine
 
NexDog's Avatar
 
Join Date: Jan 2002
Location: The Nexus
Posts: 13,328
I just rewrote my instructions to make it a bit clearer in step-by-step form. It's actually not that bad.
__________________
Laurence - [HostNexus Administrator]

- Need Support? Quickest reponses are found at the Support Helpdesk!
- Stay in touch! Make sure you are subscribed to our Lists.
NexDog is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 04:40 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.0 RC1
Copyright ©2001 - 2009, HostNexus