Need Guidance on Email Piping to WHMCS in HestiaCP (Replacing cPanel Setup)

Hello All,

I recently migrated my WHMCS installation from a cPanel server to a new server running HestiaCP.

On my previous cPanel server, WHMCS ticket creation worked perfectly using email piping (cPanel → Forwarders → “Pipe to a Program”). Incoming emails were piped directly to WHMCS pipe.php and tickets were created automatically.

Now on HestiaCP, I am trying to replicate the same setup but I am not sure what the correct method is.

What I am trying to achieve:

  • Incoming email is delivered to a mailbox on the server

  • That mailbox then pipes the message to WHMCS (pipe.php)

  • WHMCS creates a support ticket automatically

What I used on cPanel (working):

  • Pipe command similar to:
    /usr/bin/php -q /home/USERNAME/public_html/whmcs/crons/pipe.php

What I tried on HestiaCP (not working):

  • I created a mailbox in Hestia

  • I attempted to set up forwarding / piping, but I do not see a clear “Pipe to Program” option like cPanel

  • WHMCS ticket import via IMAP/POP is not an option in my case (does not work reliably)

Questions:

  1. Does HestiaCP support per-mailbox piping to a program/script like cPanel?

  2. If yes, where is it configured in Hestia (forwarders, Exim rules, etc.)?

  3. What is the correct syntax for piping to a PHP script on Hestia?

  4. Are there any special permissions required for WHMCS pipe.php or the mailbox user?

  5. Is there a recommended WHMCS email piping setup specifically for HestiaCP?

Any guidance or example configuration would be appreciated.

Thank you.

Hi,

No, Hestia doesn’t support it.

From now on, I will use testuser as the Hestia user, example.com as the domain and [email protected] as the email account receiving the tickets and piping them to WHMCS.

Technically it’s possible, Hestia uses the file /etc/exim4/domains/example.com/aliases to manage aliases and forwards. Said that, you can add this to that file:

[email protected]:"|/usr/bin/php -q /home/testuser/web/example.com/public_html/whmcs/crons/pipe.php

And it should work fine but…

The problems with that approach:

1.- You must add it manually because Hestia will detect it as invalid format when trying to add it from the Web UI.

2.- If you rebuild the mail domain, Hestia will remove that entry and that’s a big problem.

3.- You could edit directly the mail conf file /usr/local/hestia/data/users/testuser/mail/example.com.conf and edit the FWD variable for your user and that will work, even after rebuild the mail domain but if you try to visit your mail domain in Hestia Web UI you will get a beautiful error 500 :frowning:

Said that, you can achieve the goal editing the exim conf /etc/exim4/exim4.conf.template and adding this as a router:

whmcs_router:
  driver = accept
  domains = example.com
  local_parts = support
  require_files = /home/testuser/web/example.com/public_html/whmcs/crons/pipe.php
  transport = whmcs_pipe_transport
  unseen 
  no_verify

In context:

######################################################################
#                      ROUTERS CONFIGURATION                         #
#               Specifies how addresses are handled                  #
######################################################################
begin routers

whmcs_router:
  driver = accept
  domains = example.com
  local_parts = support
  require_files = /home/testuser/web/example.com/public_html/whmcs/crons/pipe.php
  transport = whmcs_pipe_transport
  unseen 
  no_verify

send_via_unauthenticated_smtp_relay:
  driver = manualroute 
  address_data = SMTP_RELAY_HOST:SMTP_RELAY_PORT
  domains = !+local_domains
  require_files = SMTP_RELAY_FILE
  condition = ${if eq{SMTP_RELAY_USER}{}}
  transport = remote_smtp
  route_list = * ${extract{1}{:}{$address_data}}::${extract{2}{:}{$address_data}}
  no_more
  no_verify

And you must also add the transport:

whmcs_pipe_transport:
  driver = pipe
  command = /usr/bin/php -q /home/testuser/web/example.com/public_html/whmcs/crons/pipe.php
  home_directory = /home/testuser
  current_directory = /home/testuser
  user = testuser
  group = testuser
  return_fail_output

In context:

######################################################################
#                      TRANSPORTS CONFIGURATION                      #
######################################################################
begin transports

whmcs_pipe_transport:
  driver = pipe
  command = /usr/bin/php -q /home/testuser/web/example.com/public_html/whmcs/crons/pipe.php
  home_directory = /home/testuser
  current_directory = /home/testuser
  user = testuser
  group = testuser
  return_fail_output

smtp_relay_smtp:
  driver = smtp
  hosts_require_auth = $host_address
  hosts_require_tls = $host_address

Once modified, restart Exim.

systemctl restart exim4

And try it.

I would rather not edit those systemwide configs, but use dovecot sieve for a single mailbox.

Sieve rules don’t allow piping mail to an external program, so this approach defeats the purpose.

However, it can be done using the vnd.dovecot.pipe plugin (enabled by default) together with sieve_extprograms, but you must also configure this explicitly in the global Dovecot configuration.

Sahsanu and Maurice, Thank you for your valuable insights; they have been incredibly helpful. After collaborating with WHMCS tech support, I have decided to utilize POP3/IMAP for the email setup instead of PHP piping. The only notable difference is a potential email delay of up to 5 minutes, but I’m in the process of transitioning to Microsoft 365, so that isn’t a major concern. I truly appreciate your prompt and thorough response—thank you!

2 Likes