The cPanel software that most web hosts provide to their clients (this includes BeliefMedia) makes email management easy. Along with the typical features you're most likely familiar with - such as email creation, autoresponders, and forwarding - these's another option hidden away in the 'Advanced Options' tab that will 'Pipe to a Program'. This Piping routes an incoming email to hosted software that manages the message in some way. It's this piping that is the focus of this article.
Why Pipe email?
There are any number of reasons why one might Pipe their email to a PHP or other script. Consider the following limited examples:
- Handle unrouted email. cPanel already provides a feature to send unrouted email to an email address, email account, or the system account, so this example example is a little redundant. However, we can personalise the experience by capturing those details of incoming emails, save those details to a database (and maybe even add the email to a general email marketing database), and then send a structured and potentially converting email as your 'Email Unavailable' reply (think of it as a custom "404 Not Found" reply for email).
- Email to SMS List Features. Since we disabled our Outlook to SMS tools we're compelled to introduce easier and more efficient ways for our clients to send group texts (rather than logging into their self-hosted Platform and performing the task caveman-style). Piping permits this by evaluating the complex 'to' field and then, if an instruction is defined, we will schedule an SMS to all of the recipients in that particular list.
- SMS Notifications. If you require notifications when a particular email is received, querying the subject line or sender could immediately trigger an SMS alert.
- Manage Unused Domains. We have a large number of domain names - some of which were previously owned and some of which are generic enough that they're confused with another organisation (one of our domains receives thousands of weekly emails by virtue of the similarity to a Government department). We're somewhat obligated to notify those people that their email was sent into a black hole, and a reply is an appropriate means of communicating this message. However, rather than the generic reply cPanel provides via its 'Failure Message' options, a potential opportunity exists to introduce your business by way of a message that might spark a little interest. Keeping a database table populated with all inbound emails would prevent the message sent twice, and would also prevent that infinite loop should the sender also be providing a generic response.
- Email Competition Registrations. For our clients, a competition or other similar venture might be served by having clients send an email with nothing other than their phone number in the subject line. Any message that you would otherwise disqualify (say, an empty or invalid subject) might trigger an email sending the user to a landing page with online options, while others would be subscribed to a particular competition and associated email campaign. Options and funnel-style flows are entirely customisable. This is obviously just one example; the same user might be able to subscribe via text message in the same way.
- Finance Applications. It's the finance applications that we're currently working on. Based on the information within, say, an ApplyOnline email or similar, we're able to parse the message, find identifying information, and then trigger other actions... even if it's just adding a note to aggregator or internal systems, or creating an Outlook task based on the nature of the message. Pictured: Apply Online emails. Any email from email@example.com might be evaluated for various tasks. Some systems, such as SalesTrekker, negate the need for this email-level intervention by way of webhooks.
Since the ApplyOnline notification emails follow a predictable pattern they can easily be parsed for data and then sent to a database for compliance keeping purposes. Email can often be a difficult medium for which to operate when looking for important information so it makes sense to make it fully indexed for permanency. This is just one of the features we plan to implement soon.
- Support Desks. One might choose to evaluate all incoming email for a support code or similar in a subject field that identifies the message as best served by a particular team, certain software, or an individual.
If you'd like to have a play with the feature yourself, upload a PHP file to your server with the following code. It will simply dump the content of the email into a text file.
Note the first line is a hashbang (or shebang) instruction; no spaces should come before or after that line and your opening PHP tags.
Once your script location is defined in cPanel you'll start to see all your emails as text files in your emails folder. The below image gives you an idea of the frequency of genuine yet incorrectly addressed emails to just one of our dormant domains.
To retrieve the primary email attributes, consider the following:
The above code is rather inefficient because it iterates through each line with multiple expressions. You might consider evaluating the entire text for an occurrence of the email field you're looking for and, if present, perform the expression. Or you might simply perform all expressions on the entire email string.
Perform an expression on each field that you would like stored in your database. In reality you won't save anything to a text file; once you're done with the data and performed any necessary action the email will makes its way into a big digital black hole.
The problem as it relates to our clients is that we're asking that they host their primary email with Microsoft so that they might benefit from the countless features we're integrating with our systems. However, Microsoft does provide excellent webhooks that permits us to query or poll data when it's required. That said, many of our clients still have a secondary company email domain that they host with us for non-client purposes. Either way, we'll ensure that they have a solution for whatever systems we introduce.
A marketing company is compelled to do whatever it can at every touchpoint to optimise and convert in any way in which it can, and the examples provided on this page are a good example of where technology drives solutions when no generic product ever could. At the risk of sounding like I'm giving ourselves an out-of-place plug, our highly customised technology is just one reason why our finance clients enjoy industry-leading results.
Keep any eye out for other cPanel, and cPanel API related articles .