Question

How to Piping email to PHP Script in DigitalOcean

I need to pipe incoming emails to a specific address to a PHP script on DigitalOcean. I have done this on shared servers in Cpanel using a forwarder to |/opt/alt/php56/usr/bin/php -q /home/somesite/public_html/folder/somescript.php but I’m not sure how to set up something similar (if possible) on DigitalOcean VPS.


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Ryan Quinn
DigitalOcean Employee
DigitalOcean Employee badge
March 21, 2018
Accepted Answer

In 15+ years working with PHP I’ve never had to use this particular feature. Doing some research, it seems that every reference to this I’ve found relies on this feature in cPanel rather than using lower level tools.

We generally recommend against running your own email services. They can quickly become a major time-sink and require more attention than most services to prevent abuse.

If you are writing the handler script yourself you have some other options. One alternative would be to create a CRON job that runs every few minutes and checks a POP or IMAP mailbox for new messages. This way there would be no piping and your script would simply pull new messages from the mail server you are using.

Another option would be to use cPanel on your server in order to take advantage of this feature in the same way you did previously. We don’t offer cPanel licenses but you can purchase a VPS license from cpanel.net or a reseller and install it on your droplet. cPanel/WHM features it’s own installer that makes the initial setup quite easy.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel