Roundcube Community Forum

 

Filtering does not work by Diagnostic-Code header

Started by BK201, August 12, 2023, 11:34:26 AM

Previous topic - Next topic

BK201

Hello
I am trying to filter incoming emails by the content of the "Diagnostic-Code" header, an example of such a header:

Diagnostic-Code: smtp; 550-5.1.1 The email account that you tried to reach does not exist. Please try
550-5.1.1 double-checking the recipient's email address for typos or
550-5.1.1 unnecessary spaces. Learn more at
550 5.1.1  https://support.google.com/mail/?p=NoSuchUser sd2-20020a170906ce2200b00992e2779596si3982608ejb.827 - gsmtp


I am trying to find the phrase "The email account that you tried to reach does not exist", for this purpose I created a rule for filter in the settings, screenshot:


But unfortunately the rule doesn't work. What am I doing wrong. Please help.

Example of an incoming message:
Return-path: <>
Envelope-to: [email protected]
Delivery-date: Fri, 11 Aug 2023 22:56:31 +0300
Received: from exim by mail.mysite.com with local (Exim 4.92.2)
id 1qUYFL-0003JL-T4
for [email protected]; Fri, 11 Aug 2023 22:56:31 +0300
X-Failed-Recipients: [email protected]
Auto-Submitted: auto-replied
From: Mail Delivery System <[email protected]>
To: [email protected]
Content-Type: multipart/report; report-type=delivery-status; boundary=1691783791-eximdsn-1073901725
MIME-Version: 1.0
Subject: Mail delivery failed: returning message to sender
Message-Id: <[email protected]>
Date: Fri, 11 Aug 2023 22:56:31 +0300

--1691783791-eximdsn-1073901725
Content-type: text/plain; charset=us-ascii

This message was created automatically by mail delivery software.

A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:

  [email protected]
    host gmail-smtp-in.l.google.com [173.194.79.26]
    SMTP error from remote mail server after RCPT TO:<[email protected]>:
    550-5.1.1 The email account that you tried to reach does not exist. Please try
    550-5.1.1 double-checking the recipient's email address for typos or
    550-5.1.1 unnecessary spaces. Learn more at
    550 5.1.1  https://support.google.com/mail/?p=NoSuchUser sd2-20020a170906ce2200b00992e2779596si3982608ejb.827 - gsmtp

--1691783791-eximdsn-1073901725
Content-type: message/delivery-status

Reporting-MTA: dns; mail.mysite.com

Action: failed
Final-Recipient: rfc822;[email protected]
Status: 5.0.0
Remote-MTA: dns; gmail-smtp-in.l.google.com
Diagnostic-Code: smtp; 550-5.1.1 The email account that you tried to reach does not exist. Please try
550-5.1.1 double-checking the recipient's email address for typos or
550-5.1.1 unnecessary spaces. Learn more at
550 5.1.1  https://support.google.com/mail/?p=NoSuchUser sd2-20020a170906ce2200b00992e2779596si3982608ejb.827 - gsmtp

--1691783791-eximdsn-1073901725
Content-type: message/rfc822

Return-path: <[email protected]>
Received: from admin by mail.mysite.com with local (Exim 4.92.2)
(envelope-from <[email protected]>)
id 1qUYFL-0003JC-LG
for [email protected]; Fri, 11 Aug 2023 22:56:31 +0300
To: [email protected]
Subject: =?utf-8?B?0JDQutGC0LjQstCw0YbQuNGPINCw0LrQutCw0YPQvdGC0LA=?=
X-PHP-Originating-Script: 1002:class.phpmailer.php
Date: Fri, 11 Aug 2023 22:56:31 +0300
From: [email protected]
Message-ID: <[email protected]>
X-Mailer: DLE CMS
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: base64


Dmitry42

Open your INBOX and select gmail error message. At top of message (under string FROM) you can see links: Details Headers.
Click on Headers - and you can see all headers of this message. I think you can't see here header "Diagnostic-Code"

So I think your string with "Diagnostic-Code" its not header - its just message body then you must use filter "BODY contains".