Jump to content

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:
* ^To.whatever@foo.com
| /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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.