Spamreport Template Macros - List of Macros

Jun 3, 2019
13
1
23
NRW Germany
Hi PMG Community,
I am trying to build my own "spamreport-custom.tt" to inform the users with the help of a script more frequently on new items in their quarantine. Background is, that we implemented a "Bad Filestype / Extention as Attachment" rule, to filter attachments based on their fIletype and extension. This method works already very reliable, but when I use the macro "[%item.file%]" I am wondering that the name of the file in the quarantine folder is shown. It would be more interesting for the end-user to see the original name of the file to get an impression if it is an expected file from a valid sender or really some attachment they are not interested in.

So my questions on this:
  • Is there a list of available macros besides of item.file or is there some source code reference, I can look into, for the valid options currently supported?
  • Is there another commandline tool or option I can lookup the original name of an blocked attachment? maybe in the objects saved in the database?
  • How do you inform users on the blocked attachments, maybe somebody has a solution I possibly looked over yet
Thank you in advance for reading and sharing your thoughts on this.

TOJ
 
  • Is there a list of available macros besides of item.file or is there some source code reference, I can look into, for the valid options currently supported?
we should document this, you can have a look at the source where we fill the item data: https://git.proxmox.com/?p=pmg-api....a7ab677df53b8b9e177f;hb=refs/heads/master#l61

  • Is there another commandline tool or option I can lookup the original name of an blocked attachment? maybe in the objects saved in the database?
not really, besides parsing the mail file...

  • How do you inform users on the blocked attachments, maybe somebody has a solution I possibly looked over yet
as a matter of fact, in git we already applied a new feature 'attachment quarantine' where you can copy a mail into an attachment quarantine and send the email the users with those attachments removed
(will probably some time until that feature hits the repositories)
 
Hi Dominik,
thank you for pointing me to the source code.

I will check the details and maybe I can already build some solution to show the original name of the blocked attachment. But a quick check showed that only item.file is available and this references only the name of the file in the spam folder and not the original name of the file.
Right now I tend to build a script to parse the mail.log and lookup the message ID to cut the original name of the blocked file but due to the fact that I want to run the job quite frequently this will have an impact to the performance, as I have to parse the complete file over and over again..

The new "attachment quarantine" will also have some API support? I checked the eMails in [pmg-devel] from yesterday where Thomas L. announced the new feature in the GUI and I am wondering if there will be some kind of API later on, to work with this quarantine i.e. in scripts to automate some things.

Thank you again and regards, TOJ
 
The new "attachment quarantine" will also have some API support? I checked the eMails in [pmg-devel] from yesterday where Thomas L. announced the new feature in the GUI and I am wondering if there will be some kind of API later on, to work with this quarantine i.e. in scripts to automate some things.
since the gui only works by querying the api, yes of course, you can check out the current api here: https://pmg.proxmox.com/pmg-docs/api-viewer/index.html
(this is also available on every pmg install via https://your-pmg:8006/pmg-docs/api-viewer/index.html )
 
Hi Dominik,
just to be sure, in the latest PMG Release "pmg-api/6.0-6/b0c1ded4 (running kernel: 5.0.21-2-pve)" this change is not yet included right?

Is there a howto, howto patch the system with this new attachment handling in the UI and API? Or is this just a one-liner?

Thank you again, TOJ
 
just to be sure, in the latest PMG Release "pmg-api/6.0-6/b0c1ded4 (running kernel: 5.0.21-2-pve)" this change is not yet included right?
correct, there is not a release with it included yet

Is there a howto, howto patch the system with this new attachment handling in the UI and API? Or is this just a one-liner?
i am not sure what you are asking, do you mean how you can patch it yourself? or if there will be an package upgrade later?
 

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!