-1

I have set up an email server using iRedMail, which uses postfix/dovecot. It seems working fine.

Next I'd like to have it call a user-defined script (preferably PHP, but would be fine otherwise), when a new email arrives at any of the mailboxes on the email server. The details of the email, including sender, recipient, subject, body, attachments, and time, will be passed to the script.

The motivation behind this is that we need to trigger some higher-level workflow upon email arrivals. And we don't want to use IMAP API to poll the server, since it's inefficient and not realtime.

I have tried a few links to no avail. These include: http://www.iredmail.org/docs/pipe.incoming.email.for.certain.user.to.external.script.html https://www.thecodingmachine.com/triggering-a-php-script-when-your-postfix-server-receives-a-mail/

Any help would be appreciated.

lgc_ustc
  • 1,524
  • 2
  • 20
  • 31

1 Answers1

0

Email piping is the term you are looking for.

I have used this resource in the past.

alistaircol
  • 1,433
  • 12
  • 22