Login Login



Wanted articles
Who is online?
Article tools

Email Piping

From osTicket

Revision as of 10:12, 22 April 2014 by Josh (Talk | contribs)

Jump to: navigation, search

The email piping is a technique of sending email message as an input to a program rather than appending the message to the mailbox file, allowing for real-time email delivery and handling. Every mail server has its own rules and procedures for mail delivery, making it hard to provide common instructions for configuring an MTA. You should refer to your hosting manual or contact your hosting provider for email piping instructions if none of the methods below works for you.

  • osTicket supports both remote and local piping
  • Email piping must be enabled in admin panel

Local Piping

Local piping refers to the case where osTicket is installed on a server also handling your emails. Most shared hosting users fall into this category.

Setting up aliases in cPanel

Add a forwarding rule for each of the email addresses to /path/to/api/pipe.php.

For example forward support@domain.com to "|/path/to/api/pipe.php"

CPANEL X Instructions

CPANEL -> Email -> Forwarders -> Add Forwarder

1. Address to a forwarder: @domain
2. Advanced Options -> Pipe to a Program:  <code>"public_html/osticket/api/pipe.php"</code>
3. Click 'Add Forwarder' button

When complete you will see:

@domain to |/home//public_html/osticket/api/pipe.php

  • assumption is you unpackaged osticket.tar in /home/USERNAME/public_html/
  • Pipe to a Program path: if you have a leading '/' cPanel will use the path you enter, if you do not have '/' cPanel will create it relative to your home directory
  • pipe.php should have hashbang at the top of the file: #!/usr/bin/php -q
  • Make pipe.php executable chmod 755 pipe.php
  • Enable email piping in admin panel Settings -> preference  Note: This option appears to be removed from v1.7 - piping works without enabling.

Mail delivery failed

If you have the error: 'Mail delivery failed: returning message to sender' but the user's email is still successfully processed.

You have some options:

1. Update php.ini

/usr/local/lib/php.ini update: display_errors Off

restart apache

2. Update exim.conf

Update /etc/exim.conf in the section:


 driver = pipe


 driver = pipe
 group = "${lookup{$domain}lsearch* {/etc/userdomains}{$value}}"
 user = "${lookup{$domain}lsearch* {/etc/userdomains}{$value}}"

Change return_output to return_fail_output

REASON: (from exim.conf comment)

If the pipe generates any standard output, it is returned to the sender of the message as a delivery error. Set return_fail_output instead of return_output if you want this to happen only when the pipe fails to complete normally. You can set different transports for aliases and forwards if you want to - see the references to address_pipe below.

Setting up aliases with qmail

Create/Edit your .qmail-* for the domain you wish to forward and add a forwarding rule to/path/to/api/pipe.php. For example for support@domain.com .qmail-support file should contain|/path/to/api/pipe.php

Setting up aliases for sendmail

Modify your aliases file by adding support: root, |/path/to/api/pipe.php and run newaliases.

Setting up aliases in .procmailrc

 :0 c
    * ^To.*support@domain.com

Setting up aliases in Plesk (Postfix)

See this blog post from Dave.

Remote Piping

Remote piping is useful when osTicket installation and the mail server are on two separate machines. To maintain logic in one place remote piping is done over HTTP post to osTicket's API. osTicket ships with two scripts to help you accomplish this task; automail.php and automail.pl. Both accomplish the same task by posting tohttp://www.yourdomain.com/osticket/api/tickets.email (replace osticket with the folder name where you installed osticket)

  • Remote host IP must be white listed in Admin Panel > Manage > API Keys
  • Valid API key required
  • Follow local piping instructions above to pipe emails to remote script which will in turn post to osTicket

For technical details, please refer to API Docs.