<div dir="ltr"><div>in this article</div><div><br></div><a href="http://www.thecodingmachine.com/triggering-a-php-script-when-your-postfix-server-receives-a-mail/">http://www.thecodingmachine.com/triggering-a-php-script-when-your-postfix-server-receives-a-mail/</a><br><div><br></div><div>somebody shows a way to run a PHP script when the mail server (postfix in this case) receives a mail.</div><div><br></div><div>Cant the same be done with a FPC console application ?</div><div><br></div><div>Thank you</div><div><br></div><div>Peppe</div><div><br></div><div>---</div><div><span class="im" style="font-size:12.8px">On Thu, 18 Feb 2016, duilio foschi wrote:<br><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">we have a linux server with domain (say)<br><br><a href="http://www.ourserver.com/" rel="noreferrer" target="_blank">www.ourserver.com</a><br><br>A mail server of some type is installed.<br><br>The mail server uses the following mysql tables:<br><br>+----------------------+<br>| Tables_in_mailserver |<br>+----------------------+<br>| view_aliases |<br>| view_users |<br>| virtual_aliases |<br>| virtual_domains |<br>| virtual_users |<br>+----------------------+<br><br>Probably some of you will quickly recognize the sort of mailserver used<br>here (I dont remember its name).<br><br>By accessing these tables from MySQL I know how to create a new email<br>account and how to forward emails sent to each mail account.<br><br>Is there a way to programmatically intercept all incoming emails, process<br>them and eventually store them in a database ?<br></blockquote><br></span><span style="font-size:12.8px">You should define a filter for your MTA. The filter is then a program you</span><br style="font-size:12.8px"><span style="font-size:12.8px">write, and this program can do whatever it wants. It will need to report</span><br style="font-size:12.8px"><span style="font-size:12.8px">back to the MTA. Usually some pre-defined exit codes are used for this.</span><span class="im" style="font-size:12.8px"><br><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><br>If possible, I'd like to do that by Lazarus CGIs.<br></blockquote><br></span><span style="font-size:12.8px">I don't think </span><span class="" style="font-size:12.8px;background-color:rgb(255,255,255)">CGI</span><span style="font-size:12.8px"> is an option for such a system.</span><div class="" style="font-size:12.8px"><div id=":a1w" class="" tabindex="0"><img class="" src="https://ssl.gstatic.com/ui/v1/icons/mail/images/cleardot.gif"></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-02-18 10:23 GMT+01:00 duilio foschi <span dir="ltr"><<a href="mailto:octopushole@gmail.com" target="_blank">octopushole@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra">we have a linux server with domain (say)</div><div class="gmail_extra"><br></div><div class="gmail_extra"><a href="http://www.ourserver.com" target="_blank">www.ourserver.com</a></div><div class="gmail_extra"><br></div><div class="gmail_extra">A mail server of some type is installed.</div><div class="gmail_extra"><br></div><div class="gmail_extra">The mail server uses the following mysql tables:</div><div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_extra">+----------------------+</div><div class="gmail_extra">| Tables_in_mailserver |</div><div class="gmail_extra">+----------------------+</div><div class="gmail_extra">| view_aliases |</div><div class="gmail_extra">| view_users |</div><div class="gmail_extra">| virtual_aliases |</div><div class="gmail_extra">| virtual_domains |</div><div class="gmail_extra">| virtual_users |</div><div class="gmail_extra">+----------------------+</div><div class="gmail_extra"><br></div><div class="gmail_extra">Probably some of you will quickly recognize the sort of mailserver used here (I dont remember its name).</div><div class="gmail_extra"><br></div><div class="gmail_extra">By accessing these tables from MySQL I know how to create a new email account and how to forward emails sent to each mail account.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Is there a way to programmatically intercept all incoming emails, process them and eventually store them in a database ?</div><div class="gmail_extra"><br></div><div class="gmail_extra">If possible, I'd like to do that by Lazarus CGIs.</div><div class="gmail_extra"><br></div><div class="gmail_extra">What exactly I'd like to do is to check for some special tokens in the incoming emails and store or forward them accordingly.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Please instruct me re where to start.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Thank you</div><div class="gmail_extra"><br></div><div class="gmail_extra">Peppe</div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div></div></div>
</blockquote></div><br></div></div>