Jump to content

procmail to php


shawngoldw

Recommended Posts

Hello, I need to run a php script whenever my server receives email. It has been recommended to me to use procmail to trigger the php script.

 

I have zero experience with procmail and need some guidance  :-[

 

I just need a simple procmail script which will run a php script every time an incoming email is received.

 

If someone could either show me the few lines I need or point me where to find them it would be greatly appreciated.

 

Thanks,

Shawn

Link to comment
https://forums.phpfreaks.com/topic/204307-procmail-to-php/
Share on other sites

There should be plenty of examples of this around on the net, but basically, in ~/.procmailrc you use patterns to match email addresses (or subject lines) and determin what to do with the email (generally sending them to a different inbox). This can be used to pipe an email to a php script. eg;

 

:0:
* ^[email protected]
| /usr/local/bin/script.php

Link to comment
https://forums.phpfreaks.com/topic/204307-procmail-to-php/#findComment-1070102
Share on other sites

Thank you very much.

 

I have a couple questions.

what does the second line do?

When you say "pipe an email to a php script" do you mean that the email gets passed into the script? or just that the php script gets called? If it's the first case, how do you access the passed in email from within php?

Link to comment
https://forums.phpfreaks.com/topic/204307-procmail-to-php/#findComment-1070111
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.