Problem with MAIL FROM: regexp

igor_ka

New Member
Jun 10, 2020
6
0
1
45
Mail was sent using the Mozilla Tunderbird. Messages with enabled delivery notification has unsuccessful tests on pmg-smtp-filter with reply error "501 5.5.2 Syntax: MAIL FROM: <address>". I watched traffic through tcpdump.
With disabled delivery notification "MAIL FROM" string is: MAIL FROM:<user@mail.com> SIZE=787 BODY=8BITMIME
With enabled delivery notification "MAIL FROM" string is: MAIL FROM:<user@mail.com> SIZE=787 BODY=8BITMIME ENVID=<aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa@mail.com> RET=FULL
 
Could you please provide the logs (from the PMG) for such a mail?

Thanks
 
For message with disabled delivery notification:

Jun 10 19:24:08 mailgate postfix/smtpd[28780]: connect from internalmail.mail.com[192.168.1.30]
Jun 10 19:24:08 mailgate postfix/smtpd[28780]: NOQUEUE: client=internalmail.mail.com[192.168.1.30]
Jun 10 19:24:08 mailgate pmg-smtp-filter[27738]: 2020/06/10-19:24:08 CONNECT TCP Peer: "[127.0.0.1]:53020" Local: "[127.0.0.1]:10023"
Jun 10 19:24:08 mailgate pmg-smtp-filter[27738]: 4604A05EE0B4C8AF18D: new mail message-id=<aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa@mail.com>#012
Jun 10 19:24:08 mailgate pmg-smtp-filter[27738]: 4604A05EE0B4C8AF18D: SA score=0/5 time=0.073 bayes=0.00 autolearn=no autolearn_force=no hits=AWL(-0.755),BAYES_00(-1.5),BODY_SINGLE_WORD(2.236),KHOP_HELO_FCRDNS(0.4)
Jun 10 19:24:08 mailgate postfix/smtpd[28783]: connect from localhost.localdomain[127.0.0.1]
Jun 10 19:24:08 mailgate postfix/smtpd[28783]: D95104402E3: client=localhost.localdomain[127.0.0.1], orig_client=internalmail.mail.com[192.168.1.30]
Jun 10 19:24:08 mailgate postfix/cleanup[28784]: D95104402E3: message-id=<aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa@mail.com>
Jun 10 19:24:08 mailgate postfix/qmgr[26313]: D95104402E3: from=<user@mail.com>, size=1501, nrcpt=1 (queue active)
Jun 10 19:24:08 mailgate pmg-smtp-filter[27738]: 4604A05EE0B4C8AF18D: accept mail to <another_user@externalmail.com> (D95104402E3) (rule: default-accept)
Jun 10 19:24:08 mailgate postfix/smtpd[28783]: disconnect from localhost.localdomain[127.0.0.1] ehlo=1 xforward=1 mail=1 rcpt=1 data=1 commands=5
Jun 10 19:24:08 mailgate pmg-smtp-filter[27738]: 4604A05EE0B4C8AF18D: processing time: 0.247 seconds (0.073, 0.049, 0)
Jun 10 19:24:08 mailgate postfix/smtpd[28780]: proxy-accept: END-OF-MESSAGE: 250 2.5.0 OK (4604A05EE0B4C8AF18D); from=<user@mail.com> to=<another_user@externalmail.com> proto=ESMTP helo=<mx.mail.com>
Jun 10 19:24:08 mailgate postfix/smtpd[28780]: disconnect from internalmail.mail.com[192.168.1.30] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5
Jun 10 19:24:10 mailgate postfix/smtp[28785]: Trusted TLS connection established to mx.externalmail.com[1.2.3.4]:25: TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256
Jun 10 19:24:12 mailgate postfix/smtp[28785]: D95104402E3: to=<another_user@externalmail.com>, relay=mx.externalmail.com[1.2.3.4]:25, delay=3.7, delays=0.09/0.04/2.2/1.4, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued on f1.mail.externalmail.com as 1591784652-NGNUqhsnTs-OBm8lx0i)
Jun 10 19:24:12 mailgate postfix/qmgr[26313]: D95104402E3: removed


For message with enabled delivery notification:

Jun 10 19:24:16 mailgate postfix/smtpd[28780]: connect from internalmail.mail.com[192.168.1.30]
Jun 10 19:24:16 mailgate postfix/smtpd[28780]: NOQUEUE: client=internalmail.mail.com[192.168.1.30]
Jun 10 19:24:16 mailgate pmg-smtp-filter[27996]: 2020/06/10-19:24:16 CONNECT TCP Peer: "[127.0.0.1]:53026" Local: "[127.0.0.1]:10023"
Jun 10 19:24:16 mailgate postfix/smtpd[28780]: warning: proxy 127.0.0.1:10023 rejected "MAIL FROM:<user@mail.com> SIZE=787 BODY=8BITMIME ENVID=<bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb@mail.com> RET=FULL": "501 5.5.2 Syntax: MAIL FROM: <address>"
Jun 10 19:24:16 mailgate postfix/smtpd[28780]: proxy-reject: END-OF-MESSAGE: 501 5.5.2 Syntax: MAIL FROM: <address>; from=<user@mail.com> to=<another_user@externalmail.com> proto=ESMTP helo=<internalmx.mail.com>
Jun 10 19:24:16 mailgate postfix/smtpd[28780]: disconnect from internalmail.mail.com[192.168.1.30] ehlo=1 mail=1 rcpt=1 data=0/1 quit=1 commands=4/5
 
Hmm - does the problem persist if you disable before queue filtering?
Thanks!
 
With disabled before queue filtering message delivered. And i've got notification message not received before this.

Here is log:
Jun 11 00:10:20 mailgate postfix/smtpd[32151]: connect from internalmail.mail.com[192.168.1.30]
Jun 11 00:10:20 mailgate postfix/smtpd[32151]: 318E64400B9: client=internalmail.mail.com[192.168.1.30]
Jun 11 00:10:20 mailgate postfix/cleanup[32155]: 318E64400B9: message-id=<cccccccc-cccc-cccc-cccc-cccccccccccc@mail.com>
Jun 11 00:10:20 mailgate postfix/qmgr[32024]: 318E64400B9: from=<user@mail.com>, size=1310, nrcpt=1 (queue active)
Jun 11 00:10:20 mailgate postfix/smtpd[32151]: disconnect from internalmail.mail.com[192.168.1.30] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5
Jun 11 00:10:20 mailgate pmg-smtp-filter[32202]: 2020/06/11-00:10:20 CONNECT TCP Peer: "[127.0.0.1]:53468" Local: "[127.0.0.1]:10023"
Jun 11 00:10:20 mailgate pmg-smtp-filter[32202]: 46049C5EE0F7DC35CAB: new mail message-id=<cccccccc-cccc-cccc-cccc-cccccccccccc@mail.com>#012
Jun 11 00:10:20 mailgate pmg-smtp-filter[32202]: 46049C5EE0F7DC35CAB: SA score=0/5 time=0.113 bayes=0.00 autolearn=no autolearn_force=no hits=AWL(-0.745),BAYES_00(-1.5),BODY_SINGLE_WORD(2.236),KHOP_HELO_FCRDNS(0.4)
Jun 11 00:10:20 mailgate postfix/smtpd[32162]: connect from localhost.localdomain[127.0.0.1]
Jun 11 00:10:20 mailgate postfix/smtpd[32162]: 62EA44402AB: client=localhost.localdomain[127.0.0.1], orig_client=internalmail.mail.com[192.168.1.30]
Jun 11 00:10:20 mailgate postfix/cleanup[32155]: 62EA44402AB: message-id=<cccccccc-cccc-cccc-cccc-cccccccccccc@mail.com>
Jun 11 00:10:20 mailgate postfix/qmgr[32024]: 62EA44402AB: from=<user@mail.com>, size=1516, nrcpt=1 (queue active)
Jun 11 00:10:20 mailgate postfix/smtpd[32162]: disconnect from localhost.localdomain[127.0.0.1] ehlo=1 xforward=1 mail=1 rcpt=1 data=1 commands=5
Jun 11 00:10:20 mailgate pmg-smtp-filter[32202]: 46049C5EE0F7DC35CAB: accept mail to <another_user@externalmail.com> (62EA44402AB) (rule: default-accept)
Jun 11 00:10:20 mailgate pmg-smtp-filter[32202]: 46049C5EE0F7DC35CAB: processing time: 0.217 seconds (0.113, 0.042, 0)
Jun 11 00:10:20 mailgate postfix/lmtp[32156]: 318E64400B9: to=<another_user@externalmail.com>, relay=127.0.0.1[127.0.0.1]:10023, delay=0.24, delays=0.01/0/0/0.22, dsn=2.5.0, status=sent (250 2.5.0 OK (46049C5EE0F7DC35CAB))
Jun 11 00:10:20 mailgate postfix/cleanup[32155]: 6D2F34403BC: message-id=<20200610151020.6D2F34403BC@mailgate.mail.com>
Jun 11 00:10:20 mailgate postfix/qmgr[32024]: 6D2F34403BC: from=<>, size=3910, nrcpt=1 (queue active)
Jun 11 00:10:20 mailgate postfix/bounce[32165]: 318E64400B9: sender delivery status notification: 6D2F34403BC
Jun 11 00:10:20 mailgate postfix/qmgr[32024]: 318E64400B9: removed
Jun 11 00:10:20 mailgate postfix/smtp[32163]: Trusted TLS connection established to internalmail.mail.com[192.168.1.30]:25: TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)
Jun 11 00:10:21 mailgate postfix/smtp[32166]: Trusted TLS connection established to mx.externalmail.com[1.2.3.4]:25: TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256
Jun 11 00:10:21 mailgate postfix/smtp[32163]: 6D2F34403BC: to=<user@mail.com>, relay=internalmail.mail.com[192.168.1.30]:25, delay=1.2, delays=0/0/0.01/1.2, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 49hr5S3Wgyz1V5c)
Jun 11 00:10:21 mailgate postfix/qmgr[32024]: 6D2F34403BC: removed
Jun 11 00:10:22 mailgate postfix/smtp[32166]: 62EA44402AB: to=<another_user@externalmail.com>, relay=mx.externalmail.com[1.2.3.4]:25, delay=1.9, delays=0.03/0/0.76/1.1, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued on f1.mail.externalmail.com as 1591801822-j8GjWAqxi6-AL9mQlJb)
Jun 11 00:10:22 mailgate postfix/qmgr[32024]: 62EA44402AB: removed
 
hmm - is the message sent by a intermediate server or directly from Thunderbird -> PMG

In any case you can open an enhancement request over at https://bugzilla.proxmox.com (please link the thread and attach the logs there)

No promises when/if this will be dealt with though...

Thanks!
 
I am presenting the exact same problem.

Thunderbird-->Zimbra-->PMG
Jun 12 10:52:11 mail1 postfix/smtpd[5008]: connect from zimbra-mta.mydomain.com[192.168.100.8]
Jun 12 10:52:11 mail1 postfix/smtpd[5008]: Anonymous TLS connection established from zimbra-mta.mydomain.com[192.168.100.8]: TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)
Jun 12 10:52:11 mail1 postfix/smtpd[5008]: NOQUEUE: client=zimbra-mta.mydomain.com[192.168.100.8]
Jun 12 10:52:11 mail1 pmg-smtp-filter[4619]: 2020/06/12-10:52:11 CONNECT TCP Peer: "[127.0.0.1]:52016" Local: "[127.0.0.1]:10023"
Jun 12 10:52:11 mail1 postfix/smtpd[5008]: warning: proxy 127.0.0.1:10023 rejected "MAIL FROM:<zzzzz@mydomain.com> SIZE=1488 BODY=8BITMIME ENVID=<4e76fa9b-7faf-0823-054a-013db1b72d92@mydomain.com> RET=FULL": "501 5.5.2 Syntax: MAIL FROM: <address>"
Jun 12 10:52:11 mail1 postfix/smtpd[5008]: proxy-reject: END-OF-MESSAGE: 501 5.5.2 Syntax: MAIL FROM: <address>; from=<zzzzzzz@mydomain.com> to=<xxxxxxxx@teknik.io> proto=ESMTP helo=<zimbra-mta.mydomain.com>
Jun 12 10:52:11 mail1 postfix/smtpd[5008]: disconnect from zimbra-mta.mydomain.com[192.168.100.8] ehlo=2 starttls=1 mail=1 rcpt=1 data=0/1 quit=1 commands=6/7

Thunderbird --> PMG

Not sended mail error in smtp communication.

An error occurred while sending the email. The mail server replied: 501 5.5.2 Syntax: MAIL FROM: <address>. Check the message and try again.
 
Last edited:
Is it correct to write the config line
Bash:
-o smtpd_discard_ehlo_keywords=silent-discard,dsn
like below to the template file as a temporary workaround?

Bash:
[% pmg.mail.int_port %]       inet  n -       -       -       [% pmg.mail.max_smtpd_out %]      smtpd
[% IF pmg.mail.before_queue_filtering -%]
  -o smtpd_proxy_filter=127.0.0.1:10023
  -o smtpd_proxy_options=speed_adjust
  -o smtpd_client_connection_count_limit=[% pmg.mail.conn_count_limit div 5 %]
[%- ELSE -%]
  -o content_filter=scan:127.0.0.1:10023
[%- END %]
  -o smtpd_recipient_restrictions=permit_mynetworks,reject_unauth_destination
  -o smtpd_discard_ehlo_keywords=silent-discard,dsn
  -o smtpd_helo_restrictions=
  -o smtpd_client_restrictions=
  -o smtpd_sender_restrictions=
 
looks about right (as always - test it and keep an eye on the logs)

you need to copy the template to /etc/pmg/templates first as well

I hope this helps!
 
looks about right (as always - test it and keep an eye on the logs)

you need to copy the template to /etc/pmg/templates first as well

I hope this helps!
Thanks, copied the template or course. The workarround seems to work fine.
 

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!