This post shows how to set Email Piping for various mail servers –
EXIM MAIL SERVER
Open file — /etc/valiases/yourdomain.com
Assuming that we are setting up support@yourdomain.com,
sales@yourdomain.com, billing@yourdomain.com we will create the corresponding entries in the file as follows:
support@yourdomain.com: “|/full_path_to/console/pipe.php”
sales@yourdomain.com: “|/full_path_to/console/pipe.php”
billing@yourdomain.com: “|/full_path_to/console/pipe.php”
Save the alias file and run this command on shell – newaliases This will add the alias file.
cPanel use exim mail server and you can set alias from cPanel too — cPanel >> Mail section Forwarders set –
support@yourdomain.com: “|/full_path_to/console/pipe.php”
sales@yourdomain.com: “|/full_path_to/console/pipe.php”
billing@yourdomain.com: “|/full_path_to/console/pipe.php”
POSTFIX MAIL SERVER
Open alias file: generally its — /etc/postfix/aliases
You can check what alias file you have on your server — find line virtual_alias_maps in file /etc/postfix/main.cf
virtual_alias_maps = hash:/etc/postfix/aliases
So based on what is virtual_alias_maps set in main.cf you can edit respective file — in our case we will consider –/etc/postfix/aliases
Edit /etc/postfix/aliases and add below lines
support@yourdomain.com “|/full_path_to/console/pipe.php”
sales@yourdomain.com “|/full_path_to/console/pipe.php”
billing@yourdomain.com “|/full_path_to/console/pipe.php”
Save the alias file and run this command on shell – newaliases This will add the alias file.
If you made any changes in main.cf then run command –
service postfix reload
Second method is using .forward file for piping.
1) Open alias file: generally its — /etc/postfix/aliases
You can check what alias file you have on your server — find line virtual_alias_maps in file /etc/postfix/main.cf
virtual_alias_maps = hash:/etc/postfix/aliases
So based on what is virtual_alias_maps set in main.cf you can edit respective file — in our case we will consider –/etc/postfix/aliases
Edit /etc/postfix/aliases and add below line (This line is for catch-all)
@yourdomain.com accountusername
2) and in /home/accountusername create .forward file with this line
/home/accountusername/public_html/support/console/pipe.php
That’s it!
QMAIL MAIL SERVER
Open alias file:
/usr/local/qmail/mailnames/yourdomain.com/support/.qmail
The above alias file is for the email support@yourdomain.com. In certain installations the alias file can also be created as:
Alias File:
/usr/local/qmail/mailnames/company.com/.qmail-support
You should open the above alias files and point them to full path to console/pipe.php, prefixed with the “|” (Pipe) symbol.
support@yourdomain.com: “|/full_path_to/console/pipe.php”
SENDMAIL SERVER
Step 1: Add an alias in /etc/alias for support email. Be sure to rebuild the alias file after by typing newaliases at the command line.
support: “|/usr/bin/php -q /full_path_to/console/pipe.php”
Step 2: chmod the script so it is executable:
chmod 755 /full_path_to/console/pipe.php
Step 3: Create a symbolic link in /etc/smrsh so sendmail will know about script. If you don’t do this then sendmail will give error message Service unavailable, and smrsh: “php” not available for sendmail programs (stat failed).
cd /etc/smrsh
ln -s /usr/bin/php ./php
ln -s /full_path_to/console/pipe.php ./pipe.php
Note that if you are installing a script on a virtual site you need to make the above changes in the virtual site files. So instead of adding links in /etc/smrsh you would add them in /home/virtual/siteXX/fst/etc/smrsh and instead of adding the alias in /etc/aliases, you would add them in /home/virtual/siteXX/fst/etc/aliases. Then to rebuild the aliases DB, you need to do this:
/usr/sbin/chroot /home/virtual/siteXX/fst newaliases
3 comments
Trackback e pingback
-
How to set email piping in Vision Helpdesk? - Questions & Answers - FAQ Alert.com
[...] Read more on How to set Email Piping on SendMail , Qmail and Postfix. [...]
We are happy to offer 












using qmail and havind inserted the path to pipe.php into .qmail i get
: deferral: /bin/sh:_true_:_command_not_found/
i than have set -qmail to 755 status and i get
deferral: Uh-oh:_.qmail_has_prog_delivery_but_has_x_bit_set._(#4.7.0)/
what shall i try next?
thank you, edgar
The message looks pretty straightforward: the .qmail file has the execute bit
set and has a program delivery instruction in it, and qmail doesn’t like that.
If you check command —
man dot-qmail
If .qmail has the execute bit set, it must not contain any
program lines, mbox lines, or maildir lines. If qmail-
local sees any such lines, it will stop and indicate a
temporary failure.