Script Triggered by Return Path

This forum is for discussing Mailtraq's Scripting features. Get help with Mailtraq scripts, templates and external ActiveX scripting.

Script Triggered by Return Path

Postby Malc » Mon Nov 03rd, 2008 9:54am

I'd like to reroute all messages sent from (or claiming to be sent from) a certain domain (i.e. the domain of the "RCPT TO" command) to an address other than the intended recipient. I have a script that does the appropriate MsgSetRcpts(), and works, but I can't get it to trigger.

My script is enabled (!), the trigger is "Message Trigger", the trigger is filtered on Any of "Sender", "From" or "Return Path" matching "*@the.domain.in.question", the script is tagged to modify the message, and execution is during Inbound Mail Delivery. Ideally I'd only want to use "Return Path", but I'm just trying anything at present.

The same script used in a different automation entry, and configured as above except that it triggers only on "Received" matching "the.domain.in.question", works fine.

Am I being dense? Do I need to trigger later in the delivery process (in which case it's too late to change the recipient, as far as I can see) to use the return path; or is it possibly a bug in Mailtraq (builds 2.14.1.2442 and 2.14.1.2422 both exhibit the same behaviour)?
User avatar
Malc
Expert User
 
Posts: 242
Joined: Thu Dec 30th, 2004 1:46am
Location: London^WSurrey^WEssex^WCambs^WLondon^WEssex^WLancs^WEssex

Re: Script Triggered by Return Path

Postby Malc » Mon Nov 03rd, 2008 9:58am

I appreciate, by the way, that I can trigger the script on all messages, and test for "HostOf(AddressOf(MsgGetSender()))" matching my criterion, but that strikes me as being less efficient than having Mailtraq perform the filtering.
User avatar
Malc
Expert User
 
Posts: 242
Joined: Thu Dec 30th, 2004 1:46am
Location: London^WSurrey^WEssex^WCambs^WLondon^WEssex^WLancs^WEssex

Re: Script Triggered by Return Path

Postby Martin Clayton » Mon Nov 03rd, 2008 2:06pm

Malc wrote:the trigger is filtered on Any of "Sender", "From" or "Return Path" matching "*@the.domain.in.question", the script is tagged to modify the message, and execution is during Inbound Mail Delivery. Ideally I'd only want to use "Return Path", but I'm just trying anything at present.

Ideally, the filters would have access to the smtp routing fields. The non-firing sounds mighty strange - I can imagine possible timing issues for the Return-Path & Sender headers but you're also testing From, which is static. Can you provide an example message? If that's tricky, all I can suggest is checking the filter in .cfg and altering the wildcard - either remove it or add another one at the end of the expression.
User avatar
Martin Clayton
Expert User
 
Posts: 529
Joined: Sat Jan 15th, 2005 8:20am
Location: London, UK

Re: Script Triggered by Return Path

Postby Malc » Mon Nov 03rd, 2008 2:18pm

My tests have been with telnet, so minimal headers. The script triggers on "Received", so Mailtraq has already added its first such header when the filter is applied.

I'll try adding wildcards. (I'll try anything...)
User avatar
Malc
Expert User
 
Posts: 242
Joined: Thu Dec 30th, 2004 1:46am
Location: London^WSurrey^WEssex^WCambs^WLondon^WEssex^WLancs^WEssex

Re: Script Triggered by Return Path

Postby Malc » Mon Nov 03rd, 2008 2:29pm

OK, I'm an idiot. "From:" does work. The tests I made when "From:" was present didn't test for it; and the tests I made when I was testing for it didn't have a "From:" header. Sorry about that. <blush>

"Return-Path" and "Sender" definitely don't work, so I can only assume Mailtraq adds the "Received" header before the "Inbound Mail Delivery", but the "Return-Path" header afterwards.

Now I shall test to see if I can use a different trigger while retaining the ability to re-route.
User avatar
Malc
Expert User
 
Posts: 242
Joined: Thu Dec 30th, 2004 1:46am
Location: London^WSurrey^WEssex^WCambs^WLondon^WEssex^WLancs^WEssex

Re: Script Triggered by Return Path

Postby Malc » Mon Nov 03rd, 2008 3:03pm

On reading RFC 5321 properly, it becomes clear that a message only gets a Return-Path header when it effectively drops out of SMTP to POP3, IMAP4 etc.

So, the only way to access the SMTP Envelope From seems to be within a script, so I'll need to run the script on every message. Rats!
User avatar
Malc
Expert User
 
Posts: 242
Joined: Thu Dec 30th, 2004 1:46am
Location: London^WSurrey^WEssex^WCambs^WLondon^WEssex^WLancs^WEssex


Return to Mailtraq Scripting

Who is online

Users browsing this forum: No registered users and 2 guests

cron