Proxmox Mail Gateway : How to add Subject Information to the log

Posted by

I have Proxmox Mail Gateway (PMG) and I need to add subject information to the log. This subject is needed to get detailed information about the email that has been sent. So, I can trace the email in the log with this message trace.

Below is what I did

Go to RuleDB folder

cd /usr/share/perl5/PMG/RuleDB





Add this line before “if ($qid) {” (line 126)

syslog('info', "$qid: warning: header Subject: %s from $msginfo->{fqdn}", PMG::Utils::decode_rfc1522(PVE::Tools::trim($entity->head->get('subject'))) || 'No Subject');

So the line will be like this

Restart pmg-smtp-filter

systemctl restart pmg-smtp-filter

Now, you can see the subject information on the log

Feb 14 21:18:01 pmg pmg-smtp-filter[13026]: 80CA81C1076: warning: header Subject: Test sending email to from
Feb 14 21:18:01 pmg pmg-smtp-filter[13026]: 1C107563EB981976CAC: accept mail to  (80CA81C1076) (rule: default-accept)

And you can trace with the zmmsgtrace script here: How To Add Subject Information on Message Trace

The results

/srv/zmmsgtrace /var/log/mail.log

Tracing messages

Message ID '20230214211801.007912@ThinkPad-X230'
Subject 'Test sending email to' -->
  Feb 14 21:18:01 - localhost.localdomain (], orig_client=unknown[ --> ( status sent

If you need PMG Support and Subscription, please feel free to contact my Company:

Good luck 🙂

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.