Skip to content

Comment on Ask YC: How do I send incoming email to a PHP script?

Comments

In the postfix configuration, enable allow_mail_to_commands ( http://www.postfix.org/postconf.5.html ). In a Unix account home directory, create a .forward file which begins with a pipe symbol and names your script: |./my_mail_stub.php

For each message sent to the account, postfix will run your script. Your script can obtain the raw message from stdin.

You'll be pleased to know that the principle for sendmail and qmail configuration is broadly similar and shouldn't require any changes to your script.

Thanks a bunch. Just about got it working.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.