Content Filtering problem which includes multiple recipients with tradition email address and (3) email to text. | MDaemon Technologies, Ltd.

Content Filtering problem which includes multiple recipients with tradition email address and (3) email to text.


  • Understanding the following:

    In MDaemon, when an email is sent to multiple recipients (either directly in the To/CC fields or through a mailing list), the Content Filter processes a separate copy of the message for each recipient. This means you can create content filter rules that treat each recipient's copy individually, allowing you to tailor actions based on the specific recipient.

    Processing email address that “..treat each recipient's copy individually” is crutial

    Details:

    Sent an email with (4) four recipients (1) standard email address and (3) three utilizing email to text functionality provided by a third party. After sending for our server Mdaemon generated (2) two files in the "Inbound" queue the .ctl file (below) and the original email with .msg.

    In this file ”Example CTL file” it correctly created each recipients as in the example below:

                    0=DRXXXXEBRAXXX@GMAIL.COM DRXXXXEBRAXXX@GMAIL.COM

                    1=XXX7829566@mms.att.net XXX7829566@mms.att.net

                    2=XXX7824133@mms.att.net XXX7824133@mms.att.net

                    3=XXX7824132@txt.att.net XXX7824132@txt.att.net

    Example CTL file

    [Parameters]

    MailFrom=INFO@XXX.COM

    Helo=localhost.localdomain

    SpamFilterSkipReason=message from trusted or authenticated source

    AntivirusSkipReason=

    RemoteIP=1X2.67.X8.X0

    SpecialMessageID=<MDAEMON-F202508061003.AA0327883md5001000010599@mail.TESTDOMAIN.local>

    RemoteName=localhost.localdomain

    PTRHostName=

    Sender=INFO@TESTDOMAIN-UL.COM

    MailLookupResult=pass reason="white listed" policy.iprev=19X.67.68.X0 (MAIL INFO@TESTDOMAIN-UL.COM)

    HeloLookupResult=

    PtrLookupResult=

    ActiveDomainName=TESTDOMAIN.local

    MessageID=<202508061404.576E4SUJ029098@localhost.localdomain>

    DKIMHeaderMatch=0

    DKIMApproved=0

    SPFApproved=0

    SPFResult=8

    SPFMechanism=default

    SPFError=

    SPFAuthResults=

    SpamHoneypots=0

    SpamScore=0

    DMARCResult=5

    DMARCPolicy=none

    DMARCDNS=

    DMARCAuthorDomain=

    DMARCSampling=23

    DMARCpct=100

    ARCResult=none

    ConnectionType=ESMTPS

    FromHeaderAddress=INFO@TESTDOMAIN-UL.COM

    RBLHeaderWarning=

    RBLIPWarning=

    Outbreak=1/0/0/str=0001.0A00211D.68935FEF.003D,ss=1,re=0.000,recu=0.000,cl=1,cld=1,fgs=0

    SSLCipher=TLSv1.2:AES-SHA2:256

    [Recipients]

    0=DRXXXXEBRAXXX@GMAIL.COM DRXXXXEBRAXXX@GMAIL.COM

    1=XXX7829566@mms.att.net XXX7829566@mms.att.net

    2=XXX7824133@mms.att.net XXX7824133@mms.att.net

    3=XXX7824132@txt.att.net XXX7824132@txt.att.net

     

     

     

    To this point everything is working correctly.  Next as MDAEMON processed the request and moved the email into the "REMOTE" queue it's important to see how the CONTENT FILTER RULES are affecting each "newly" created instance of the .msg file. 

     

    This is CONTENT FILTER RULE (in question) located in CFRULES.DAT.

     

    As you can see "Rule001" (below) we are taking the domain (i.e. mms.att.net, etc) and changing it to our third party vendor that will converts our emails and transmit each via SMS.

     

    [Rule001]

    RuleName=Inbound Check: SMS -> ATT provider

    uid={f0207087-4b75-488d-9457-d5208644b7e2}

    Enable=Yes

    ThisRuleCondition=Any

    ProcessQueue=REMOTE

    Condition01=X-MDAEMON-DELIVER-TO|reg exp|AND|@mms.att.net|@txt.att.net+|

    Action01=add header|"X-MDaemon-Deliver-To","1$RECIPIENTMAILBOX$@XXXXXXX.sms.us.notifyre.com"

    Action02=remove header|"X-MDaemon-Deliver-To","$RECIPIENT$"

     

    NOTE: When adding or removing a header I found remove the header first it additional removes our ability to add a new header using the variable $RECIPIENT$ (which in all cases was empty).  This rule has been tested and works very well on emails with ONE address (i.e. XXX7824132@txt.att.net). 

     

     

    This is the result I found in the REMOTE queue.

                    Our expectation would be (4) four individual emails, but instead we have only (3) three.

     

    Filenames: pd5001001646255, pd5001001646256, pd5001001646257

     

    The .rte file is as follows

     

    [RemoteHost]

    DeliverTo=mms.att.net

    IgnoreRcptErrors=No

    [RemoteRcpts]

    Rcpt0=XXX7824133@mms.att.net

    Rcpt1=XXX7829566@mms.att.net

     

     

     

    pd5001001646255:

    X-MDAV-Result: clean

    X-MDAV-Processed: mail.TESTDOMAIN-UL.COM , Wed, 06 Aug 2025 13:18:09 -0400

    Received: by mail.TESTDOMAIN-UL.COM  with ESMTPS id md5001001480808.msg; Wed, 06 Aug 2025 13:18:09 -0400

    VBR-Info: md=TESTDOMAIN-UL.COM ; mc=all; mv=vbx.emailcertification.org;

    X-Spam-Processed: mail.TESTDOMAIN-UL.COM , Wed, 06 Aug 2025 13:18:09 -0400

                    (not processed: message from trusted or authenticated source)

    X-MDOP-RefID: str=0001.0A00211D.68935FEF.003D,ss=1,re=0.000,recu=0.000,cl=1,cld=1,fgs=0 (_st=1 _vt=0 _iwf=0)

    X-MDRemoteIP: 19X.67.68.X0

    X-MDHelo: localhost.localdomain

    X-MDArrival-Date: Wed, 06 Aug 2025 13:18:09 -0400

    X-Return-Path: prvs=131313f7ef=INFO@ TESTDOMAIN-UL.COM

    X-Envelope-From: INFO@ TESTDOMAIN-UL.COM

    X-MDaemon-Deliver-To: DRXXXXEBRAXXX@GMAIL.COM

     

    As indicated in our CTL file:

     

    0=DRXXXXEBRAXXX@GMAIL.COM DRXXXXEBRAXXX@GMAIL.COM

     

    pd5001001646256:

     

    X-MDAV-Result: clean

    X-MDAV-Processed: mail.TESTDOMAIN-UL.COM , Wed, 06 Aug 2025 13:18:09 -0400

    Received: by mail.TESTDOMAIN-UL.COM  with ESMTPS id md5001001480808.msg; Wed, 06 Aug 2025 13:18:09 -0400

    VBR-Info: md=TESTDOMAIN-UL.COM ; mc=all; mv=vbx.emailcertification.org;

    X-Spam-Processed: mail.TESTDOMAIN-UL.COM , Wed, 06 Aug 2025 13:18:09 -0400

                    (not processed: message from trusted or authenticated source)

    X-MDOP-RefID: str=0001.0A00211D.68935FEF.003D,ss=1,re=0.000,recu=0.000,cl=1,cld=1,fgs=0 (_st=1 _vt=0 _iwf=0)

    X-MDRemoteIP: 19X.67.68.X0

    X-MDHelo: localhost.localdomain

    X-MDArrival-Date: Wed, 06 Aug 2025 13:18:09 -0400

    X-Return-Path: prvs=131313f7ef=INFO@TESTDOMAIN-UL.COM

    X-Envelope-From: INFO@TESTDOMAIN-UL.COM

    Received: from localhost.localdomain (localhost [127.0.0.1])

                    by localhost.localdomain (8.14.7/8.14.7) with ESMTP id 576E4S0D029106;

                    Wed, 6 Aug 2025 10:04:28 -0400

    Received: (from scott@localhost)

                    by localhost.localdomain (8.14.7/8.14.7/Submit) id 576E4SUJ029098;

                    Wed, 6 Aug 2025 10:04:28 -0400

    Date: Wed, 6 Aug 2025 10:04:28 -0400

    From: "XXXX" <INFO@ TESTDOMAIN-UL.COM >

    To: "USER1" <XXX7824132@txt.att.net>,

            " USER2" <XXX7824133@mms.att.net>,

            " USER3" <XXX7829566@mms.att.net>,

            " USER4 " <DRXXXXEBRAXXX@GMAIL.COM>

     

    ITEMS TO NOTE: X-MDaemon-Deliver-To is missing completely from this file.

     

     

    pd5001001646257:

     

    X-MDAV-Result: clean

    X-MDAV-Processed: mail.TESTDOMAIN-UL.COM , Wed, 06 Aug 2025 13:18:09 -0400

    Received: by mail.TESTDOMAIN-UL.COM  with ESMTPS id md5001001480808.msg; Wed, 06 Aug 2025 13:18:09 -0400

    VBR-Info: md=TESTDOMAIN-UL.COM ; mc=all; mv=vbx.emailcertification.org;

    X-Spam-Processed: mail.TESTDOMAIN-UL.COM , Wed, 06 Aug 2025 13:18:09 -0400

                    (not processed: message from trusted or authenticated source)

    X-MDOP-RefID: str=0001.0A00211D.68935FEF.003D,ss=1,re=0.000,recu=0.000,cl=1,cld=1,fgs=0 (_st=1 _vt=0 _iwf=0)

    X-MDRemoteIP: 19X.67.68.X0

    X-MDHelo: localhost.localdomain

    X-MDArrival-Date: Wed, 06 Aug 2025 13:18:09 -0400

    X-Return-Path: prvs=131313f7ef=INFO@TESTDOMAIN-UL.COM

    X-Envelope-From: INFO@TESTDOMAIN-UL.COM

    Received: from localhost.localdomain (localhost [127.0.0.1])

                    by localhost.localdomain (8.14.7/8.14.7) with ESMTP id 576E4S0D029106;

                    Wed, 6 Aug 2025 10:04:28 -0400

    Received: (from scott@localhost)

                    by localhost.localdomain (8.14.7/8.14.7/Submit) id 576E4SUJ029098;

                    Wed, 6 Aug 2025 10:04:28 -0400

    Date: Wed, 6 Aug 2025 10:04:28 -0400

    Message-Id: <202508061404.576E4SUJ029098@localhost.localdomain>

    From: "CENTRAL STATION" <INFO@TESTDOMAIN-UL.COM >

    To: "USER1" <XXX7824132@txt.att.net>,

                         " USER2" <XXX7824133@mms.att.net>,

                         " USER3" <XXX7829566@mms.att.net>,

                          " USER4" < DRXXXXEBRAXXX@GMAIL.COM >

    Cc:

    Subject: Zone Notification: Account: 2093606 Name: DICKINSON & BRANON DENTAL

    IMPORTANCE: LOW

    Status: O

    X-MDaemon-Deliver-To: 1XXX7824132@ XXXXXXX.sms.us.notifyre.com

    Return-Path: prvs=131313f7ef=INFO@TESTDOMAIN-UL.COM

    X-MDCFSigsAdded: TESTDOMAIN-UL.COM

    ITEMS TO NOTE: X-MDaemon-Deliver-To has correctly been added into the file with the original removed.

     

    Content Filtering File

     

    Wed 2025-08-06 13:18:09.814: Content Filter processing j:\mdaemon\queues\remote\md5001001646256.msg...

    Wed 2025-08-06 13:18:09.814: * Message return-path: prvs=131313f7ef=INFO@TESTDOMAIN-UL.COM

    Wed 2025-08-06 13:18:09.814: * Message from: INFO@TESTDOMAIN-UL.COM

    Wed 2025-08-06 13:18:09.814: * Message to: XXX7824132@txt.att.net              <-Content filtering [Rule001] NOT HIT

    Wed 2025-08-06 13:18:09.814: * Message subject: Zone Notification: Account: 2093606 Name: DICKINSON & BRANON DENTAL

    Wed 2025-08-06 13:18:09.814: * Message ID: <202508061404.576E4SUJ029098@localhost.localdomain>

    Wed 2025-08-06 13:18:09.814: Start Content Filter results

    Wed 2025-08-06 13:18:09.816: * Message matched rule: 5 "Outbound: Step 1:  Pre-Process: DKIM:  Add: HEADER 1 & 2" (Hits: 886225)

    Wed 2025-08-06 13:18:09.816: *    Condition: FROM header contains [TESTDOMAIN-UL.COM ]

    Wed 2025-08-06 13:18:09.818: *    Action: Header added to message

    Wed 2025-08-06 13:18:09.819: *    Action: Header added to message

    Wed 2025-08-06 13:18:09.820: * Message matched rule: 26 "Outbound: Step 1:Post-Process: DKIM:  Check: HEADER 1: Sign message (if possible)" (Hits: 241320)

    Wed 2025-08-06 13:18:09.820: *    Condition: X-MDDKIMSelector header exists

    Wed 2025-08-06 13:18:09.822: *    Action: Flagged for DKIM signing

    Wed 2025-08-06 13:18:09.838: * Matched 2 of 27 active rules

    Wed 2025-08-06 13:18:09.838: End of Content Filter results

    Wed 2025-08-06 13:18:09.838: ----------

    Wed 2025-08-06 13:18:09.813: Content Filter processing j:\mdaemon\queues\remote\md5001001646255.msg...

    Wed 2025-08-06 13:18:09.813: * Message return-path: prvs=131313f7ef=INFO@TESTDOMAIN-UL.COM

    Wed 2025-08-06 13:18:09.813: * Message from: INFO@TESTDOMAIN-UL.COM

    Wed 2025-08-06 13:18:09.813: * Message to: DRXXXXEBRAXXX@GMAIL.COM   <-Content filtering [Rule001] NOT HIT (EXPECTED)

    Wed 2025-08-06 13:18:09.813: * Message subject: Zone Notification: Account: 2093606 Name: DICKINSON & BRANON DENTAL

    Wed 2025-08-06 13:18:09.813: * Message ID: <202508061404.576E4SUJ029098@localhost.localdomain>

    Wed 2025-08-06 13:18:09.813: Start Content Filter results

    Wed 2025-08-06 13:18:09.815: * Message matched rule: 5 "Outbound: Step 1:  Pre-Process: DKIM:  Add: HEADER 1 & 2" (Hits: 886224)

                    Wed 2025-08-06 13:18:09.815: *    Condition: FROM header contains [TESTDOMAIN-UL.COM ]

    Wed 2025-08-06 13:18:09.817: *    Action: Header added to message

    Wed 2025-08-06 13:18:09.819: *    Action: Header added to message

    Wed 2025-08-06 13:18:09.820: * Message matched rule: 26 "Outbound: Step 1:Post-Process: DKIM:  Check: HEADER 1: Sign message (if possible)" (Hits: 241319)

    Wed 2025-08-06 13:18:09.820: *    Condition: X-MDDKIMSelector header exists

    Wed 2025-08-06 13:18:09.823: *    Action: Flagged for DKIM signing

    Wed 2025-08-06 13:18:09.845: * Matched 2 of 27 active rules

    Wed 2025-08-06 13:18:09.845: End of Content Filter results

    Wed 2025-08-06 13:18:09.845: ----------

    Wed 2025-08-06 13:18:09.815: Content Filter processing j:\mdaemon\queues\remote\md5001001646257.msg...

    Wed 2025-08-06 13:18:09.815: * Message return-path: prvs=131313f7ef=INFO@TESTDOMAIN-UL.COM

    Wed 2025-08-06 13:18:09.815: * Message from: INFO@TESTDOMAIN-UL.COM

    Wed 2025-08-06 13:18:09.815: * Message to: XXX7824132@txt.att.net

    Wed 2025-08-06 13:18:09.815: * Message subject: Zone Notification: Account: 2093606 Name: DICKINSON & BRANON DENTAL

    Wed 2025-08-06 13:18:09.815: * Message ID: <202508061404.576E4SUJ029098@localhost.localdomain>

    Wed 2025-08-06 13:18:09.815: Start Content Filter results

    Wed 2025-08-06 13:18:09.816: * Message matched rule: 1 "Inbound Check: SMS -> ATT provider" (Hits: 3533)

    Wed 2025-08-06 13:18:09.819: *    Action: Header added to message

    Wed 2025-08-06 13:18:09.822: *    Action: Header removed from message

    Wed 2025-08-06 13:18:09.823: * Message matched rule: 5 "Outbound: Step 1:  Pre-Process: DKIM:  Add: HEADER 1 & 2" (Hits: 886226)

    Wed 2025-08-06 13:18:09.823: *    Condition: FROM header contains [TESTDOMAIN-UL.COM ]

    Wed 2025-08-06 13:18:09.826: *    Action: Header added to message

    Wed 2025-08-06 13:18:09.828: *    Action: Header added to message

    Wed 2025-08-06 13:18:09.829: * Message matched rule: 26 "Outbound: Step 1:Post-Process: DKIM:  Check: HEADER 1: Sign message (if possible)" (Hits: 241321)

    Wed 2025-08-06 13:18:09.829: *    Condition: X-MDDKIMSelector header exists

    Wed 2025-08-06 13:18:09.831: *    Action: Flagged for DKIM signing

    Wed 2025-08-06 13:18:09.849: * Matched 3 of 27 active rules

    Wed 2025-08-06 13:18:09.849: End of Content Filter results

    Wed 2025-08-06 13:18:09.849: ----------

    As indicated in our CTL file:

    3=XXX7824132@txt.att.net XXX7824132@txt.att.net

     

     

    At this time I'm confused how to proceed.  We tested in a variety of ways:

    [Recipients]

    0=DRXXXXEBRAXXX@GMAIL.COM DRXXXXEBRAXXX@GMAIL.COM

    1=XXX7829566@mms.att.net XXX7829566@mms.att.net

    2=XXX7824133@mms.att.net XXX7824133@mms.att.net

    3=XXX7824132@txt.att.net XXX7824132@txt.att.net

    Standard email address "(0)" works correct if no other address is attached (DRXXXXEBRAXXX@GMAIL.COM)

    Each the three Recipients (1), (2), (3) by themeselves works correctly by hitting the appropriate Conent Filtering Rule, but when they are all together its broken.

     

     



  • The regular expression you are using, @mms.att.net|@txt.att.net+, may cause issues.  A period in a regular expression matches any character (except for line terminators).  The plus character matches the previous token between one and unlimited times, as many times as possible, giving back as needed (greedy).  This could cause the rule to be applied to unintended messages. 

    Take a look at regex101.com if you'd like assistance creating regular expressions.

    A simpler option rather than trying to add an X-MDaemon-Deliver-To header and then trying to remove the X-MDaemon-Deliver-To header would be to use a regular expression to search and replace in the existing X-MDaemon-Deliver-To header.  It would look something like this:

    Condition01=X-MDAEMON-DELIVER-TO|contains|OR|@mms.att.net|@txt.att.net|
    Action01=header search and replace|"X-MDaemon-Deliver-To","(.*)@(.*)","$1@XXXXXXX.sms.us.notifyre.com","0,1"

    None of this actually fixes the issue you are describing though.

    The reason the rule is not being applied to all of your messages is because smart spooling is enabled.  This causes MDaemon to create a route slip (RTE file) along with an MSG file.  When this happens the X-MDaemon-Deliver-To header is not added to the message before the content filter rules are applied.  This is done so that MDaemon can send the message data 1 time with multiple recipients.  It only happens when you have an identical message that needs to be delivered to two mailboxes on the same domain.

    The easiest fix is to turn off smart spooling. To do this, edit the MDaemon\app\MDaemon.ini file and set the following in the [Special] section:

    UseSmartSpooling=No

    If there is already a UseSmartSpooling key simply change the value from Yes to No.  If the key does not exist, create it. 

    Save the file and restart MDaemon.


Please login to reply this topic!