all users script

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

all users script

Postby JohnMills » Thu Mar 23rd, 2006 5:21pm

I trying to use the msg2.all that Jim created I added the password and activated the script but still does not work any ideals what I may be doing wrong????
Attachments
filter.txt
(1.71 KiB) Downloaded 1079 times
JohnMills
 
Posts: 7
Joined: Thu Mar 23rd, 2006 4:32pm

Re: all users script

Postby Martin Clayton » Thu Mar 23rd, 2006 8:13pm

Hi John,
JohnMills wrote:I trying to use the msg2.all that Jim created I added the password and activated the script but still does not work any ideals what I may be doing wrong????

Not sure but the all_pass variable must begin with "[" and end with "]". It's also got to appear at the beginning of the Subject line.

If all_pass contains wildcard characters (* or ?) the password removal routine will probably fall over but that shouldn't stop the script from 'working'.

Cheers, Martin
User avatar
Martin Clayton
Expert User
 
Posts: 529
Joined: Sat Jan 15th, 2005 8:20am
Location: London, UK

Postby JohnMills » Fri Mar 24th, 2006 7:19am

Yes that is how I have it set "[ password]" up will test again today. As to the name in the "TO" field does the format have to be "all-user@ mydomain" or does that not matter
JohnMills
 
Posts: 7
Joined: Thu Mar 23rd, 2006 4:32pm

Postby Martin Clayton » Fri Mar 24th, 2006 7:30am

JohnMills wrote:Yes that is how I have it set "[ password]" up will test again today. As to the name in the "TO" field does the format have to be "all-user@ mydomain" or does that not matter

The input message must match the filter condition you set up (on the To header) for the script to run. Logs will show "Executing Automatic Script..." if it is firing.

Cheers, Martin
User avatar
Martin Clayton
Expert User
 
Posts: 529
Joined: Sat Jan 15th, 2005 8:20am
Location: London, UK

scripts

Postby JohnMills » Fri Mar 24th, 2006 7:43am

Can I use the same script for other groups as well if I apply a different filter. I mean If I just have a group Uk@your.domain will it only target that group
JohnMills
 
Posts: 7
Joined: Thu Mar 23rd, 2006 4:32pm

Re: scripts

Postby Martin Clayton » Fri Mar 24th, 2006 9:17am

JohnMills wrote:Can I use the same script for other groups as well if I apply a different filter. I mean If I just have a group Uk@your.domain will it only target that group

Just in case we're out of synch (and/or I've misread the script or your intentions), the filter only controls whether the script fires, not who the message is sent to.

Do you want the script to discriminate between 'Mail Groups' - i.e., the recipient list includes/excludes users whose mailslots belong to specified groups?

By the way, Jim issued a more recent version of the script - as attached.

Cheers, Martin
Attachments
msg2all2.zip
(994 Bytes) Downloaded 980 times
User avatar
Martin Clayton
Expert User
 
Posts: 529
Joined: Sat Jan 15th, 2005 8:20am
Location: London, UK

Postby JohnMills » Fri Mar 24th, 2006 9:30am

Thanks for the latestes and greatest copy. Yes I would like to know if I had two groups ie" all@yourdomain.com and partial@yourdomain.com If I filtered on those groups would it only effect those groups not the entire email group
JohnMills
 
Posts: 7
Joined: Thu Mar 23rd, 2006 4:32pm

Postby Martin Clayton » Fri Mar 24th, 2006 9:50am

JohnMills wrote:Yes I would like to know if I had two groups ie" all@yourdomain.com and partial@yourdomain.com If I filtered on those groups would it only effect those groups not the entire email group

No. The only thing the filter does is determine whether the script runs; it's got nothing to do with who the message goes to.

The script could be modified in countless ways, e.g., with multiple To filters it could determine recipients based on the particular To header.

Cheers, Martin
User avatar
Martin Clayton
Expert User
 
Posts: 529
Joined: Sat Jan 15th, 2005 8:20am
Location: London, UK

Postby JohnMills » Fri Mar 24th, 2006 10:17am

Thanks I have never written a script using mailtraq. Can you point me in the right directions if I wanted to create a script for mutiple groups
JohnMills
 
Posts: 7
Joined: Thu Mar 23rd, 2006 4:32pm

Postby Martin Clayton » Fri Mar 24th, 2006 2:59pm

JohnMills wrote:Thanks I have never written a script using mailtraq. Can you point me in the right directions if I wanted to create a script for mutiple groups

I don't think it's worth learning Mailtraq's original proprietary scripting language -- the official future is with JavaScript.

There's not much documentation yet but see the Scripting Workshop examples in the Knowledgebase & FAQ forum, the script reference [url]http://resources.mailtraq.com/scriptref.html[/url] and loads of examples in Webmail.

My Javascript isn't very good but if you're stuck I could put the bones of something together ...

Cheers, Martin
User avatar
Martin Clayton
Expert User
 
Posts: 529
Joined: Sat Jan 15th, 2005 8:20am
Location: London, UK

Postby JohnMills » Fri Mar 24th, 2006 3:17pm

I'm not a jave person but if you can maybe point me in the directions whereI can get a couple of these scripts that would be nice I'm sure someone else out there has experience this same issues. Also using the password in the subject field it only works if I put it in the script like this all_pass := "password" if I use the brackets it does not work and then the password shows up in the subject field
JohnMills
 
Posts: 7
Joined: Thu Mar 23rd, 2006 4:32pm

Postby Martin Clayton » Sat Mar 25th, 2006 9:17am

JohnMills wrote:I'm not a jave person but if you can maybe point me in the directions whereI can get a couple of these scripts that would be nice

I expect you'll have to roll your own or wait for someone to deliver. I've started looking at it but my javahead isn't screwed on properly, yet.
I'm sure someone else out there has experience this same issues.

Perhaps most veer towards 'manual' name management via the aliases file (& subfiles) & mailing lists.
Also using the password in the subject field it only works if I put it in the script like this all_pass := "password" and then the password shows up in the subject field

I've now tested (v2) and I get the opposite. Authentication - and recipient expansion - only works whem the password variable and subject header use brackets.
Code: Select all
// extract key from Subject and verify
all_send := all_pass = WildcardMatchReplace(Header("Subject"), "[*]*", "[$1]");

... this authentication test requires that the Subject header starts with the full contents of all_var, including the 2 brackets. Also, there should only be the 1 "]". If either condition isn't met the message is routed to the recipient you specified in all_fail.

It may help to test on all Incoming mail - no filters. Check that the script password line is exactly:
Code: Select all
all_pass := "[password]";
    and the Subject is
Code: Select all
[password] test - good p/w
    (no opening space, no quotes).

Cheers, Martin
User avatar
Martin Clayton
Expert User
 
Posts: 529
Joined: Sat Jan 15th, 2005 8:20am
Location: London, UK

Postby Martin Clayton » Mon Mar 27th, 2006 8:20am

Martin Clayton wrote:I've now tested (v2) and I get the opposite. Authentication - and recipient expansion - only works when the password variable and subject header use brackets.
Code: Select all
// extract key from Subject and verify
all_send := all_pass = WildcardMatchReplace(Header("Subject"), "[*]*", "[$1]");

... this authentication test requires that the Subject header starts with the full contents of all_var, including the 2 brackets.

Sorry John, but I think I've been misreading this line. Looking again, I can't see why all_pass (not 'all_var') would need the brackets - in theory, it's safer without. I suspect something isn't quite working with the WildcardMatchReplace() used in the Subject rewriting. I hope to come back on this.

Meanwhile, if anyone's feeling brave I've put together a javascript version which works on Mail Groups. I'll put it in another thread.

Cheers, Martin
User avatar
Martin Clayton
Expert User
 
Posts: 529
Joined: Sat Jan 15th, 2005 8:20am
Location: London, UK

Postby Martin Clayton » Mon Mar 27th, 2006 1:17pm

Martin Clayton wrote:I can't see why all_pass (not 'all_var') would need the brackets - in theory, it's safer without. I suspect something isn't quite working with the WildcardMatchReplace() used in the Subject rewriting. I hope to come back on this.

Hmm, the brackets are needed in all_pass. I was getting unexpected results earlier but I'm not sure how I managed that -- routing and subject rewriting are working as expected now.

Cheers, Martin
User avatar
Martin Clayton
Expert User
 
Posts: 529
Joined: Sat Jan 15th, 2005 8:20am
Location: London, UK


Return to Mailtraq Scripting

Who is online

Users browsing this forum: No registered users and 1 guest

cron