Sending email TO a PHP script

software development


Does anyone know if it’s possible to forward incoming emails to PHP scripts on Dreamhost?

I’m looking to implement a solution like this one:

It looks like I need Sendmail, Exim or Qmail. How do I find out which one Dreamhost uses and will I be able to set up custom aliases that forward to a script instead of an email address?



Sendmail here.

Simon Jessey | Keystone Websites
Save $97 on yearly plans with promo code [color=#CC0000]SCJESSEY97[/color]


Thanks Simon.

Do you know if I can edit the .forward file for a specific address so that I can forward the email to a script?

I need to put the following as the forwarding address and can’t do that in the panel.


Will this require me to set up a new shell user for the incoming email address? And then can I create custom .forward files on Dreamhost?


I’m afraid I have absolutely no idea.

Since we use SquirrelMail (and I know people have RoundCube running), it is reasonable to assume that the ability to process emails with PHP exists.

Simon Jessey | Keystone Websites
Save $97 on yearly plans with promo code [color=#CC0000]SCJESSEY97[/color]


It sure is possible…

I’ve played with this before, and got it working… I will dig through my archive tonight when I get home, and post you a solution…

[color=#000000]DreamHost Promo Code[/color]: [color=#CC0000]Save $50[/color] with the promo code DREAMTEAM


I’ve got it working. It seems that you have to create a Shell or FTP user and then set up a domain that has PHP as a CGI running on that user. Then you can put the .forward file in that user’s home directory.

If there is no domain hosting with PHP on that user, then it returns errors saying it can’t run.

Not the most straightforward, but it now appears to work… Have to have this extra empty website running somewhere though!


Hey Deoleman, I was curious if you could actually post your working script. I installed what I thought was a very nice login script. It works absolutely fine in creating and accessing mysql. I’m able to log in/out and create or edit users. ONLY problem is it will not email. It has a couple php scripts passed via html for changing email address, subscribing, etc, but none of them will actually email (although the script completes saying “email sent”) I poured over dreamhost support forums for the last 7 hours with no help. The script seems to be working fine, just never get an email… Please feel free to look at any of the files. (NOTE: I’m a photographer and there isn’t actually ANY pictures on the URL yet so please don’t be scared of the name). The easiest file to play with is emailpass.html (just use It passes to a emailpass.php but I never get an email.

Any help from ANYONE greatly appreciated!