I have a wordpress site that allows users to set their location when they are logged in, and then uses the heartbeat API to their door display.

However, I have had to build in the role of managers being able to change the location for other users if that user is unable to attend their desk or is at a meeting without changing their status prior to leaving.

I was wondering, is there a way or a hook in WP that would allow my users to email the site and validate their email to their account. Then use short codes to set their location?

Something similar to the way WP lets you email your posts but for CPT or Taxonomies?


WordPress doesn't provide any built-in endpoint or API to handle incoming mail and parse it into a action.

So I see 3 possible options:

  • Use a existing mail parser for WordPress and figure out a way to run a action
  • Configure email inbox on your server and pipe incoming emails to a script to be able to parse it using a PHP parser like mailparse and then send a request to custom endpoint to perform the location update operation
  • Use a Post to WordPress plugin like Postie to be able to post to a CPT and hook into the post creation process to update the location.

A bit of explanation here:

You'd need to develop the whole thing on your own or use one of the existing integrations like Zapier and WordPress which can probably server the purpose with a bit of modifications: https://zapier.com/apps/email-parser/integrations/wordpress ( I've never used any of those so I'm not sure how good it is.)

If you rather prefer to develop it on your own this thread here is of particularly great help: https://stackoverflow.com/questions/7541278/how-do-i-parse-emails-in-realtime-as-they-are-recieved

Basically you'd need to pipe the incoming mails to a script which then uses a PHP extension like mailparse to read necessary details from the email and send a request to WordPress REST API endpoint or calls a custom Ajax action.

This is definitely going to be a decent amount of work since I don't see existing implementations similar to this.

There are some plugins that allows you to posts to WordPress via email, postie plugin seems to be promising for your purpose to be able to modify it in some way to make it post to a CPT and then hook into the create post for that CPT to be able to update the location.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.