Forwarding domain email based on PHP

I have a WordPress-based website and emails being sent to generic addresses on my domain, like president@example.com, press@example.com, etc.

Is there a way to receive all emails to my domain, process them through a PHP page (or any other kind of server-side script), and forward them to a new email address based on the script? I want to be able to automatically forward emails to different users on my site. For example, emails sent to president@example.com would check the WordPress database to see who is the current President of the organization, and forward the message to the user email on file for him.

Related posts

Leave a Reply

2 comments

  1. It would probably be best to integrate with a third party service such as Mailgun. They have a feature that POSTs incoming mail to a script on your server, which you can then parse using PHP.

    For more documentation on Mailgun’s feature specifically, see this page.