Extracting Email Metadata for Automated Reporting - Any Scripting Experts?

I’m working on a project where I need to automatically extract certain metadata from incoming emails processed by our Axigen server. Specifically, I’m interested in pulling out things like sender domain, subject line keywords, and timestamps. The goal is to feed this data into a separate system that tracks and analyzes communication patterns related to specific projects.

I’ve looked into the Axigen CLI and some of the logging options, but I’m not sure if they provide the granularity I need. Ideally, I’d like to create a script (maybe Python or something similar) that can periodically query the mail server, retrieve the relevant metadata, and format it into a CSV or JSON file.

Has anyone tackled something similar? Any advice on the best approach for accessing this data programmatically? We’re dealing with a high volume of emails, so efficiency is important.

Ultimately, this data will be used to optimize our internal workflows, including how we manage resources for different projects. For example, understanding communication spikes related to a particular project might help us better allocate resources, even down to scheduling time on specialized equipment like precision metal fabrication tools. It’s all about finding those hidden efficiencies!

Hello @adhmachinetool,

As you have noticed there is no support in Axigen for extracting the metadata you are looking for.

Note: the SMTP-IN log lines with the string New mail contain lots of useful metadata (but not the content of the the Subject header).

IMHO the best option should be to write your own milter server (for example based on python-libmilter), integrate it with Axigen (based on this KB) and process all data you are receiving from Axigen (or any other mail server that is supporting milter protocol).

If you prefere to use an already milter implementation you may start looking to mimedefang (Perl based) and start customizing mimedefang-filter code based on your needs (but I have some doubts that it will be more efficient or easy to do than first recommendation).

HTH,
Ioan