Customize Tracking Center

koby

Renowned Member
Jun 21, 2012
137
4
83
Natanya , Israel
Hello All ,
Is there any option to add more field to the Tracking Center - like Subject ?
Is there any option to set the default search to 00:00 of the current date ?

Thank you all for any answer
Koby Peleg Hen
 
Hello All ,
Is there any option to add more field to the Tracking Center - like Subject ?
No - the Tracking Center parses the mail.logs to display the information and those don't contain the subjects.

Is there any option to set the default search to 00:00 of the current date ?
This is currently not possible since PMG does not store such information per client - and the benefit does seem comparatively small

I hope this helps!
 
No - the Tracking Center parses the mail.logs to display the information and those don't contain the subjects.

How about my feature request to add subject information (as been able to be added to the mail.log by adjusting postfix a bit). Same for the envelope from (instead of the technical from) for e.g. newsletters or mails originating from ESP like Amazon SES, Sendgrid and others.
 
  • Like
Reactions: Biricon
How about my feature request to add subject information (as been able to be added to the mail.log by adjusting postfix a bit)
As said before - subjects are seldomly needed for debugging mail-flow but do contain rather sensitive information which I really would not log for privacy reasons.
Same for the envelope from (instead of the technical from)
for me the envelope from is the from used during the SMTP session (MAIL FROM command) - instead of the From Header.
 
As said before - subjects are seldomly needed for debugging mail-flow but do contain rather sensitive information which I really would not log for privacy reasons.

for me the envelope from is the from used during the SMTP session (MAIL FROM command) - instead of the From Header.

OK, then I mean the Header From. And for sure, subject logging could be an option to be enabled or not. For sure, there are privacy reasons, however, if looking at other stages e.g. secure mail gateways or mail archiving solutions, an administrator would also be able to get access to such information. For checking and adjusting the filter, it's somehow required information, so if it's optional to activate, it's on administrators choice to do so or not. However, I have it enabled on my own private installation, which I'm the only one using it, but I also need to look into the details and would be much easier to have a subject column.
 
You could add into the postfix log the subject using this technique.

Open and edit postfix configuration file
Bash:
vi /etc/postfix/main.cf

Add the following :
Code:
header_checks = regexp:/etc/postfix/header_checks

Open the file /etc/postfix/header_checks
Bash:
vi /etc/postfix/header_checks

Add the following line :
Code:
/^Subject:/     WARN

Run postmap to apply new config
Bash:
postmap /etc/postfix/header_checks

Restart postfix service
Bash:
service postfix restart

Now in the tracking center you will see something like this :
Screen Shot 2022-06-15 at 13.21.30.png
 
You could add into the postfix log the subject using this technique.

Open and edit postfix configuration file
Bash:
vi /etc/postfix/main.cf

Add the following :
Code:
header_checks = regexp:/etc/postfix/header_checks

Open the file /etc/postfix/header_checks
Bash:
vi /etc/postfix/header_checks

Add the following line :
Code:
/^Subject:/     WARN

Run postmap to apply new config
Bash:
postmap /etc/postfix/header_checks

Restart postfix service
Bash:
service postfix restart

Now in the tracking center you will see something like this :
View attachment 38021
Thanks for your help. I'm following your sugguestion and it shown the header Subject, but it was encrypted. like this:
Jun 16 11:28:15 esg02 postfix/cleanup[12749]: 0F87110043C: warning: header Subject: =?UTF-8?B?UmU6IFThuqFpIHNhbyBraMO0bmcgZ+G7rWkgdGjGsCB04bubaSBHbWFpbCDEkcaw4bujYw==?=??=?UTF-8?B?Pw==?= from mail-io1-f51.google.com[209.85.166.51]; from=<user@xxx.com> to=<user@abc.com> proto=ESMTP helo=<mail-io1-f51.google.com>
Please help
 
Last edited:
Thanks for your help. I'm following your sugguestion and it shown the header Subject, but it was encrypted. like this:
Jun 16 11:28:15 esg02 postfix/cleanup[12749]: 0F87110043C: warning: header Subject: =?UTF-8?B?UmU6IFThuqFpIHNhbyBraMO0bmcgZ+G7rWkgdGjGsCB04bubaSBHbWFpbCDEkcaw4bujYw==?=??=?UTF-8?B?Pw==?= from mail-io1-f51.google.com[209.85.166.51]; from=<tinhnd04@gmail.com> to=<tinhnd@emailgateway.online> proto=ESMTP helo=<mail-io1-f51.google.com>
Please help

I'm not sure how we can log decoded mime subject, you could use tools like online MIME headers decoder :

https://dogmamix.com/MimeHeadersDecoder/

Or you can create a script :
Perl:
#!/usr/bin/env perl
use open qw(:std :utf8);
use Encode qw(decode);

while (my $line = <STDIN>) {
        print decode("MIME-Header", $line);
}

And execute like :
Bash:
echo 'Subject: =?UTF-8?B?UmU6IFThuqFpIHNhbyBraMO0bmcgZ+G7rWkgdGjGsCB04bubaSBHbWFpbCDEkcaw4bujYw==?=??=?UTF-8?B?Pw==?= ' | ./decodeutf8.pl
 
  • Like
Reactions: tinhnd
I'm not sure how we can log decoded mime subject, you could use tools like online MIME headers decoder :

https://dogmamix.com/MimeHeadersDecoder/

Or you can create a script :
Perl:
#!/usr/bin/env perl
use open qw(:std :utf8);
use Encode qw(decode);

while (my $line = <STDIN>) {
        print decode("MIME-Header", $line);
}

And execute like :
Bash:
echo 'Subject: =?UTF-8?B?UmU6IFThuqFpIHNhbyBraMO0bmcgZ+G7rWkgdGjGsCB04bubaSBHbWFpbCDEkcaw4bujYw==?=??=?UTF-8?B?Pw==?= ' | ./decodeutf8.pl
Thanks for you help, so much. I've give it a try.
 
To capture the email subject, you can do
1. Edit /usr/bin/pmg-smtp-filter
2. Add to second line
Code:
use PVE::Tools;
3. Find
Code:
$self->log (3, "$queue->{logid}: new mail message-id=%s", $queue->{msgid});
Add bellow
Code:
$self->log (3, "$queue->{logid}: Subject: %s", PMG::Utils::decode_rfc1522(PVE::Tools::trim($entity->head->get('subject'))) || 'No Subject');
my @fromarray = split('\s*,\s*', $entity->head->get('from') || $msginfo->{sender});
$self->log (3, "$queue->{logid}: From: %s", PMG::Utils::decode_rfc1522(PVE::Tools::trim($fromarray[0])) );
4. Restart pmg-smtp-filter
 
  • Like
Reactions: vsupport and Robbus
To capture the email subject, you can do
1. Edit /usr/bin/pmg-smtp-filter
2. Add to second line
Code:
use PVE::Tools;
3. Find
Code:
$self->log (3, "$queue->{logid}: new mail message-id=%s", $queue->{msgid});
Add bellow
Code:
$self->log (3, "$queue->{logid}: Subject: %s", PMG::Utils::decode_rfc1522(PVE::Tools::trim($entity->head->get('subject'))) || 'No Subject');
my @fromarray = split('\s*,\s*', $entity->head->get('from') || $msginfo->{sender});
$self->log (3, "$queue->{logid}: From: %s", PMG::Utils::decode_rfc1522(PVE::Tools::trim($fromarray[0])) );
4. Restart pmg-smtp-filter

Thanks man !

Would it be possible for attachments too? It is very useful to be able to search by .zip extension, etc.

This feature had in another antispam..
 
Now since version 7.3-3 it is not working anymore :(

Any help?

As of my last very time consuming thread on optimizing PMG I started a new philosophie with a fresh installation with somehow only adjustments via GUI or shell, which don’t change/touch the system itself, as all such changes like here break any time. So if you’re (also) looking for such feature (I also as well like to see the given from as the envelope often is just a technical sender for bounce handling, especially at service providers for mail like mailchimp, amazonses etc.) vote up for e.g. my feature request on adding this feature to the product itself, may be optional to activate or not, but may be added to the product, so adjustments won’t break. I also had another way to ads subjects and given senders, however, it’s an adjustment which always requires to confirm new configuration files on PMG updates and don’t want to use that anymore.
 
As of my last very time consuming thread on optimizing PMG I started a new philosophie with a fresh installation with somehow only adjustments via GUI or shell, which don’t change/touch the system itself, as all such changes like here break any time. So if you’re (also) looking for such feature (I also as well like to see the given from as the envelope often is just a technical sender for bounce handling, especially at service providers for mail like mailchimp, amazonses etc.) vote up for e.g. my feature request on adding this feature to the product itself, may be optional to activate or not, but may be added to the product, so adjustments won’t break. I also had another way to ads subjects and given senders, however, it’s an adjustment which always requires to confirm new configuration files on PMG updates and don’t want to use that anymore.
Do you have a link for where I can "vote" up the feature request ? I do think the subject feature is really important it take less time trouble shooting with the end user.
 

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!