Jump to content

WHMCS Inbound Piped (tiny MTA as postfix "alternative")


Recommended Posts

For all you WHMCS users out there, proudly releasing the initial version of "whmcs-inbound-piped" for free as open source software.

So, there are basically two ways of injecting emails into the support-queue:

  1. via cron
  2. via pipe

The cron method can be quite tricky at times, especially on large incoming mail volumes. A disadvantage is also that it will add quite some delay on every received email. However it has a huge advantage of working out-of-the-box with your current external email provider (e.g GMail)

The pipe version will act instantly on every received email, but has the huge disadvantage that you need to run your own MTA (such as postfix) "locally" on the same server as where you are running WHMCS.
Additionally, since you have to run the MTA locally, this means you either have to use a different subdomain for your support emails, or you have to also process all emails from the same domain as well.

The current pipe implementation is mostly geared towards Postfix or similar. But running such a MTA is quite an effort. Especially in my case, Debian was overwriting /usr/sbin/sendmail, which I did not want as I am using nullmailer to improve performance of PHP scripts sending emails as it makes use of an async background worker (e.g. PHP is not blocking while sending an email).

This is where whmcs-inbound-piped comes into play 😍

whmcs-inbound-piped will listen on port 25 but will only process receiving emails - it does not send emails (so you can keep your current sendmail setup). Any received email will asynchronously get piped into your pipe.php script where WHMCS will process in the background.

To ensure that you do not need to worry about spam hitting your server-ip directly, you can specify (via environment variable "LISTEN_TO") an email address that the service will listen to. Any email not sent to that specific address (so make sure its random) will be dropped.

 

Quick instructions

  1. Download a zip depending on your server operating system
  2. Unzip the binary into your /usr/local/bin
  3. Create a /etc/default/whmcs-inbound-piped - you can specify any environment variable in that file as you see here
  4. Add the unit file to your systemd

You can view the logs via:

$ sudo journalctl -fu whmcs-inbound-piped


FAQ
Can this work on multiple servers?

Yes absolutely. You can create something like a "inbound.YOURCOMPANY.com" subdomain with multiple MX records pointing to each server that you want to act as a receiver.

Will this work with Google Mail?

Yes. You can create a group and subscribe your LISTEN_TO to it. Unfortunately any external email will have an ugly footer. At dd.vu I opted out of Google Mail completely in favor of IONOS Mail for this reason.

Questions and Feedback
Please post in this thread if you have any questions or comments 😅

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated