Page 1 of 1

Trigger and run PHP script when mail is received on Exim

Posted: Tue Nov 26, 2019 10:40 pm
by freelancer
Hi,

I want to trigger my below PHP script - whenever "Server" receives mail in its mail server (Exim).

PHP script:

Code: Select all

<?php
    echo "Mail received ";
    file_put_contents("/tmp/mailReceivedLog", "Last Mail Receved at".gmdate("d-m-y"));
?>
Is it possible to create "Exim" trigger which runs PHP script as soon as the mail is received?

Thanks

Re: Trigger and run PHP script when mail is received on Exim

Posted: Thu Nov 28, 2019 4:08 am
by plutocrat
Use exim's pipe transport?
https://www.exim.org/exim-html-current/ ... sport.html

Or if the mail is going to a single email address you could just monitor the directory /home/user/mail/domain.com/mailuser/
https://www.tecmint.com/watchman-monito ... -in-linux/