Change the "To" adress in an autoresponder

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

Change the "To" adress in an autoresponder

Postby Rogier » Fri Aug 10th, 2007 7:59am

HI

Is it possible to change the adress an autoresponder sends to? Or is this a fixed adress?
I tried it with MsgSetRcpts, SetHeader("To,..., but nothing works)

I'd like to make an exeption on my autoresponder-template so It does'nt send a response to message's with a "spam" notification in the subject.

tnx
Rogier
 
Posts: 26
Joined: Wed May 10th, 2006 6:23am

Re: Change the "To" adress in an autoresponder

Postby jimhill » Fri Aug 10th, 2007 9:42am

Rogier wrote:Is it possible to change the adress an autoresponder sends to?
Yes, but note that's not the same as the text in your Subject.
Rogier wrote:Or is this a fixed adress?
Nope.
Rogier wrote:I tried it with MsgSetRcpts, SetHeader("To,..., but nothing works)
MsgSetRcpts() is the correct function. SetHeader() changes only the message header (as requested in your Subject) not the message envelope. Mailtraq, and the rest of the Internet mail system, routes only on the contents of the message envelope, never the message headers. Your problem, I would guess, is that you've failed to realise the significance of the SelectInMessage() and SelectOutMessage() functions. If you want to examine the header of the incoming message, SelectInMessage() must be active. Conversely, to affect the envelope of the outgoing response, SelectOutMessage() must be active.
Rogier wrote:I'd like to make an exeption on my autoresponder-template so It does'nt send a response to message's with a "spam" notification in the subject.
You can't cause template responses not to occur (except by diverting the message to a mailslot where the offending template isn't active) so the usual technique is to route the message to the bit-bucket at Mailtraq's inbound router. You'll need something like this in your template ...
Code: Select all
SelectInMessage();
If(WildcardMatch(Header("Subject"), "*spam*"),
  Do(
    SelectOutMessage();
    SetHeader("X-Route", "dev/nul")
  )
)
... and you can then intercept that subset of messages at Mailtraq's inbound router by filtering on that new header. Create a blank script named 'dev-nul' (Console | Options | Scripts and Templates | Scripts tab) then switch to the Automated Scripting tab. Click on the Add button to create a new entry, select it and click on the Properties button. Complete the Script Properties tab as follows ...
Code: Select all
[ x ]  Enable this script
Description  [ Bit Bucket ]
Script to Execute  [ dev-nul ]
[   ]  Disable after execution
Script Trigger  [ Message Trigger ]
... then switch to the Message Trigger tab and complete as follows ...
Code: Select all
( x )  Filtered  [ (Any) X-Route = dev/nul ]
(   )  All Messages
[   ]  Script will modify the message
[ x ]  Handoff to Script
When you've done that, Mailtraq's router will swallow all messages which contain an X-Route header with matching text in the header field.

You might find it worthwhile to take a look at my autoresponder script for further ideas <[url]http://www.rdns.org/mailtraq/templates/autoresponder.zip[/url]>
jimhill
Expert User
 
Posts: 337
Joined: Sun Dec 19th, 2004 9:59pm
Location: UK

Re: Change the "To" adress in an autoresponder

Postby Rogier » Fri Aug 10th, 2007 10:54am

Thankyou very much!

This is indeed what I meant. I made a mailbox named trash. I wanted to use an "If" function to change the reply-adress so it would end in the trash.
Indeed I didn't read about the selectoutmessage and the selectinmessage functions. I'm not very experienced in scripting and really NOT experienced in scripting for mail.

Thanks for your explanation, I tried it and it works like I want it to. I'll dig in to your responder script later to see if I can upgrade mine :)
Rogier
 
Posts: 26
Joined: Wed May 10th, 2006 6:23am


Return to Mailtraq Scripting

Who is online

Users browsing this forum: No registered users and 1 guest

cron