預設不會去記錄信件主旨
因此要查找的時候有些不方便
修改方法如下
在 /etc/postfix/main.cf最後增加一行如下
header_checks = regexp:/etc/postfix/header_checks
建立 /etc/postfix/header_checks 這個檔 內容如下
/^Subject:/ WARN
接下來重啟服務
systemctl restart postfix
之後就可以在 /var/log/mail.log看到如下的log
Oct 21 06:43:49 mg postfix/cleanup[19866]: 74A29109C: warning: header Subject: Congratulate Jimmy (Gin-der) Peng for... from mailc-ab.linkedin.com[108.174.3.162]; from=<s-2f4oc1y30l5mpjzdxdjdkon8civu58akgxu9lf1h23ha66tmdhfi46d4@bounce.linkedin.com> to=<abc@de.com> proto=ESMTP helo=<mailc-ab.linkedin.com>
以上的方法在几器重開後 config就會被改回來
找到另一個方法
直接去改pmg的perl
First, add this somewhere between the 'use' statements at the beginning of the file:
use PVE::Tools;
Then search for this line:
$self->log (3, "$queue->{logid}: new mail message-id=%s", $queue->{msgid});
Add the following below that line:
$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])) );
https://forum.proxmox.com/threads/how-to-log-subjects-of-all-incoming-email.54191/
第二種方法會把subject放在獨立行
不方便查找
官方其實有提供解法方法
You can find the default templates in /var/lib/pmg/templates/. Please do not modify them directly, because your modification would get lost on the next update. Instead, copy the template you wish to change to /etc/pmg/templates/, then apply your changes there.
Templates can access any configuration setting, and you can use the pmgconfig dump command to get a list of all variable names:
# pmgconfig dump
...
dns.domain = yourdomain.tld
dns.hostname = pmg
ipconfig.int_ip = 192.168.2.127
pmg.admin.advfilter = 1
...
The same tool is used to force regeneration of all template based configuration files. You need to run that after modifying a template, or when you directly edit configuration files
# pmgconfig sync --restart 1
https://pmg.proxmox.com/pmg-docs/pmg-admin-guide.html#_service_configuration_templates
以上的方法在几器重開後 config就會被改回來
找到另一個方法
直接去改pmg的perl
First, add this somewhere between the 'use' statements at the beginning of the file:
use PVE::Tools;
Then search for this line:
$self->log (3, "$queue->{logid}: new mail message-id=%s", $queue->{msgid});
Add the following below that line:
$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])) );
https://forum.proxmox.com/threads/how-to-log-subjects-of-all-incoming-email.54191/
第二種方法會把subject放在獨立行
不方便查找
官方其實有提供解法方法
You can find the default templates in /var/lib/pmg/templates/. Please do not modify them directly, because your modification would get lost on the next update. Instead, copy the template you wish to change to /etc/pmg/templates/, then apply your changes there.
Templates can access any configuration setting, and you can use the pmgconfig dump command to get a list of all variable names:
# pmgconfig dump
...
dns.domain = yourdomain.tld
dns.hostname = pmg
ipconfig.int_ip = 192.168.2.127
pmg.admin.advfilter = 1
...
The same tool is used to force regeneration of all template based configuration files. You need to run that after modifying a template, or when you directly edit configuration files
# pmgconfig sync --restart 1
https://pmg.proxmox.com/pmg-docs/pmg-admin-guide.html#_service_configuration_templates
沒有留言:
張貼留言