Jump to content

PipeEmailToPage


MarkE
 Share

Recommended Posts

Season's greetings ProcessWirers. My gift to you is a new module called PipeEmailToPage which you can get from GitHub here: https://github.com/MetaTunes/PipeEmailToPage/tree/main. Fairly 'alpha' at the moment, but I have been using it successfully on a live site for a week or so. I'll test it some more before releasing it to the modules library.

I designed this as a replacement for ProcessEmailToPage, which relies on the flourish library which is no longer maintained. It also has a fundamentally different method of operation in that it is 'push' rather than 'pull'. The email addresses are created 'virtually' in the sense that they are not necessarily real email addresses but are held in pages whose templates are linked in the module config.

The module works when emails are piped to a script (emailpipe.php) on the server which processes the email and creates the page. The pipe needs to be defined in your hosting service's cPanel or similar. If you define the pipe in the 'Default address' in cPanel, all emails sent to the domain will be processed unless they are specified separately. The 'to' addresses will be matched against the email addresses defined in 'parent' pages holding the virtual addresses. If you define the pipe for a specific email address, only emails sent to that address will be processed (but you can define the same pipe for multiple addresses).

A major advantage of the module is that the email addresses can be defined entirely within PW. This means that they can be maintained by someone with no access to cPanel once the developer has set up the pipe.

Further details are in the readme.

I suggest you test thoroughly before using (and take careful note of the 'points to note' in the readme). Turn on some of the logging statements if you wish. Also, check your mail delivery in cPanel to look for errors there. If you report errors to me, I will do my best to hunt them, but please include as much info as possible. I will also be grateful for any suggested code improvements and/or PRs.

🎄

 

  • Like 5
  • Thanks 1
Link to comment
Share on other sites

  • 3 weeks later...

v1.0.4 is now available in the modules library. This is a major enhancement of the original with SPF/DKIM checking and a lot of functionality built into the admin page (see screenshots below).

As mentioned before, there were two motivations for this - partly to move off ProcessEmailToPage which relied on the no-longer-supported flourish library but, more importantly, to allow all email forwarding to be handled in the PW back end rather than having to set up forwarders in cPanel. The users of my 'club membership' app needed to be able to redirect forwarders, but I did not want to give them access to cPanel!

This version is now in use in two live sites and seems reasonably robust, so I have upgraded it to 'beta' status, but please do test and monitor.

The module is designed to fit in to your own custom web app. It does not do anything interesting unless you have designed the 'parent' and 'mail received' templates and programmed what you want to happen after mails are stored. That said, the admin page does provide a simplified 'inbox'. I will be looking to add a 'reply' capability shortly, but again that will only work if you have an email template defined and a way of sending emails (WireSmtp or similar).

The module readme is fairly comprehensive, so refer there for full configuration and usage details. Below are a few illustrative screens.

Module config screen (part 1): Defines the 'parents' templates and the email field to match with incoming emails. Plus the email template for pages to store the emails (under the related parent).

127270588_Config1.thumb.png.c31b017467b1d3912d26f9e142f17cdc.png

Config screen part 2: Black/white lists, SPF/DKIM checking, email file retention periods (i.e. retention of the raw incoming email file) and listerpro lister if available.

Config2.thumb.png.ad2b7731968e0c60dc6e6bbc7eda5df4.png

Example admin page. This shows mails which have been successfully processed to pages under parents. The other tabs are for 'unprocessed' emails.

Processed.thumb.png.fdaa8c30cc99c519cbb2d216cc6621fa.png

...for example, the quarantine tab shows emails that have failed SPF/DKIM checks, blacklists or the hookable checkSender() method:

Quarantined.thumb.png.01bec33ea0eede5e4b9c0b9f08894b1b.png

The maintenance/troubleshooting section separately shows processed emails with no matching page ('orphans') which may occur if the page has been trashed or deleted. It also shows (not in this illustration) if any emails are stuck in the processing queue (this may happen if an error - whether in this module or elsewhere - has caused LazyCron to lock) and provides a button to unblock it.

Orphans.thumb.png.9492950ab720e2221c90c86ea26379bb.png

Please ask if you have any questions (but not before reading the readme 😉) and report any bugs.

 

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...