Re: Hook script execution before message has been accepted with code 220?
- Peter Bauer:
> Hello,Postfix has two ways to hook into the "live" message stream:
> I would like that Postfix calls my PHP script before it accepts a
> message with code 220. So smtpd would get the message, once the
> sender has sent the command DATA and ., it should then call my PHP
> script. The script will parse the email content with header and
> body, so some thing, and if it exits with exit code 0, then smtpd
> should respond with: 220 OK other exit codes like 1 should produce
> 550, 2 450 etc.
This is SMTP-based, but Postfix does the hard work for you.
This uses a different protocol.
It's unlikely that a third hook will be added any time soon.
> Additionally, after the PHP script has been executed, postfix has
> no more to queue the mail or do other processings.
> You may ask why I'm not writing directly a SMTP daemon in PHP? Its
> because I don't want to code the complete socket handling and all
> SMTP protocol options.
> Is there a way to create this hook before the message has been
> accepted? -- Best regards, Peter Bauer Linux & UNIX developper