0

The task: upon arrival an email from (specific address) to (specific address), the message must be parsed and some actions must be done.

To be more specific. One of our personnel accounting software sends me emails about setting up mail forwarding - user retired or gone for vacations or just sick. HQ thinks that the setting up the forwarding is the sysadmin's job.

OK, to ease the things I wrote bash script, which takes 4 parameters: starting and ending dates of forwarding, and two addresses - from whom and to who to forward. The script calls zmprov to make the modifications necessary and stores the data in the pseudo-DB, which in turn processed on cron.daily.

On message arrival I copy the dates and addresses from it and paste these as CLI parameters for the script.

Because the contents of these emails is structured, I think I can write a parser which will extract the information and launch my script automatically.

But I have no idea how to launch this parser. In old FidoNET there were lots of so-called "mail-robots" - programs activated for processing incoming net/echo-mails. The API was documented and clear enough - mailer or echomail processor could trigger an event and the robot could be launched if needed.

In Zimbra I found only one way: using milters with its sendmail. Daily volume of emails on my server is about 50-75 kilo messages, and launching the milter on every message is counterproductive - there are about 1-5 forwarding requests per week.

Is there any way to launch something based on message data, not on the fact of its arrival?

Troublemaker-DV
  • 174
  • 2
  • 12

1 Answers1

1

Well... no one automates mail processing with Zimbra except for me. Let be so.

That's solution I made:

  1. Allowed the Zimbra Postfix settings "mail-to-files" and "mail-to-commands"
  2. Wrote the scripts running on cron or on mail-to-command event

Several results of research are in my blog.

common problems

postfix aliases

Thank you all, who kept silence. You made me stronger.

Troublemaker-DV
  • 174
  • 2
  • 12