How to log subjects of all incoming email?

Hello,

I'm trying to achieve the same but in the tracking center, i don't see any subject being logged. Also, is it possible to export the tracking center output to CSV ?
1.Please check whether the line
$self->log (3, "$queue->{logid}: Subject: %s", PMG::Utils::rfc1522_to_html($entity->head->get ('subject', 0)) || 'No Subject');
is really inserted under “PHASE 2” part in the "/usr/bin/pmg-smtp-filter" file.

Then...
systemctl restart pmg-smtp-filter

2. Direct export is not possible.
But you can maybe use the "/var/log/mail.log" file.
 
Hello. The line works.
$self->log (3, "$queue->{logid}: Subject: %s", PMG::Utils::decode_rfc1522(PVE::Tools::trim($entity->head->get('subject'))) || 'No Subject');
But non-ANSI symbols are not displayed in the log.

This line works better.
$self->log (3, "$queue->{logid}: Subject: %s", PMG::Utils::rfc1522_to_html($entity->head->get ('subject', 0)) || 'No Subject');
But it is much more convenient to immediately see the decoded text in the log.

When viewing, you can decode it like this.
cat mail.log | grep Subj | perl -MHTML::Entities -pe 'decode_entities($_);'

How to decode from HTML to UTF-8 immediately when writing to the log?
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!