How To: Pipe Email to a Script or Program Using Qmail ===================================================== Email pipes can be used to send all messages meant for a specific email address to a program, or script. This is commonly used when an external program, such as a help desk ticketing software or customer relationship management software, will handle emails without intervention by a user. .. contents:: To Pipe Email Using Qmail ------------------------- #. Log in to the server at the CLI as root, either via SSH or from the terminal #. At the CLI, navigate to the ``mail`` folder for the domain. The ``mail`` folder is located at ``/home/{unixuser}/var/{domain.com}/mail``, replacing ``{unixuser}`` and ``{domain.com}`` with the correct corresponding user and domain .. code:: cd /home/{unixuser}/var/{domain.com}/mail #. Using a text editor, create a file named ``.qmail-{receiving_username}``. Where ``{receiving_username}`` represents the part of the email address before the ``@``. For example, if all email directed to sales@domain.com should be handled by the external program/script, the file would be named ``.qmail-sales``. The following example uses the vim text editor .. code:: vim .qmail-{receiving_username} #. In the text editor, add the following, replacing ``{unixuser}``, ``{domain.com}``, ``{script_path}`` with the correct corresponding user, domain, and script path: .. code:: |php -q /home/{unixuser}/{domain.com}/html/{script_path} .. note:: The software vendor's documentation should provide the script path to use. #. Save the changes, and quit the text editor #. Update the permissions on the file so that it is owned as ``vpopmail:{unixuser}``, replacing ``{unixuser}`` with the correct corresponding user .. code:: chown vpopmail:{unixuser} /home/{unixuser}/var/{domain.com}/mail/.qmail-{receiving_username}