Mailing Lists Script Needed

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

Mailing Lists Script Needed

Postby chrishaislip » Tue Sep 16th, 2008 2:04pm

I am looking for a script that will remove the "Sender" field from the header information of a message that is sent to a mailing list on my Mailtraq server. My staff utilize MS Outlook for all their e-mail functions and when a user sends a message to a mailing list, Outlook tags on the "Sender" field in the header information, so when other users receive the message, it appears that the message is from "management@mydomain.com on behalf of John.User@mydomain.com" and that is really confusing my staff. I have been experimenting with scripting in a testing environment with no positive results on the matter so any assistance would be greatly appreciated.
chrishaislip
 
Posts: 7
Joined: Fri Aug 08th, 2008 9:44am

Re: Mailing Lists Script Needed

Postby jimhill » Tue Sep 16th, 2008 8:19pm

chrishaislip wrote:I am looking for a script that will remove the "Sender" field from the header information of a message that is sent to a mailing list on my Mailtraq server.
I think you'll find that your staff are being confused by the output from the mailing list, not the input. That may be why your attempts to fix the problem aren't succeeding.

chrishaislip wrote: My staff utilize MS Outlook for all their e-mail functions
Yuk!
chrishaislip wrote: and when a user sends a message to a mailing list, Outlook tags on the "Sender" field in the header information
It's the list that adds the Sender header to its output, you'll find.
chrishaislip wrote: so when other users receive the message, it appears that the message is from "management@mydomain.com on behalf of John.User@mydomain.com" and that is really confusing my staff.
Yup, m$ can't do client/server apps to save their lives.
chrishaislip wrote: I have been experimenting with scripting in a testing environment with no positive results on the matter so any assistance would be greatly appreciated.
It's pretty simple once you realise where the problem lies. You want a script which is filtered on list output messages to delete the Sender header. Assuming that the list in question adds a Sender header like this
Code: Select all
Sender: management@mydomain.com
you can remove them with a one line script like this
Code: Select all
DeleteHeader("Sender")
Drop a text file named myscript.mtq containing the above single line into \database\scripts then goto Console | Options | Scripts and Templates | Automated Script tab and click on the Add button. Select the "new event" entry, click on the Properties button and complete the Automated Script dialog as follows
Code: Select all
Script Properties tab
  [ x ]  Enable this Script
  Description  [ Remove sender from list ]
  Script to Execute  [ myscript ]
  [   ]  Disable after execution
  Script Trigger  [ Message Trigger ]

Message Trigger tab
  ( x )  Filtered
         [ (Any) Sender = management@mydomain.com ]
  (   )  All Messages
  Execute script during  [ Mail Routing ]
  [ x ]  Script will modify the message
You might like to add the list's To header (or whatever other header remains constant) to the filter condition to make absolutely sure that the script only affects list ouput messages. It's not completely unknown for some mail software to send messages to lists which contain the list's address in their Sender header. Mailtraq will reject them as invalid list input messages but your script might confuse the issue by subsequently deleting their Sender headers.
jimhill
Expert User
 
Posts: 337
Joined: Sun Dec 19th, 2004 9:59pm
Location: UK

Re: Mailing Lists Script Needed

Postby chrishaislip » Wed Sep 17th, 2008 8:17am

Jim, that one-line script worked PERFECTLY in my test environment. I am going to try and add multiple other distribution lists onto my test mailtraq server today and correct me if I am wrong, but all I need to do for this script to affect my other distribution lists is to add that distribution lists address to the filter under automatic scripting and that should then apply the script to any message sent to any of my distribution list. All of the lists that I am setting up are by subscription only and will primarily be used for staff communications such as distributing forms, event notices, etc. so I don't think I will need to worry with configuring the consistant fields exclusion in the script since my lists will always be receiving messages from subscribers only. Thanks again and if you have any other useful scripts and/or tools related to Mailtraq, let me know because I am always looking for ways to improve the features or services that an application offers and pass these features on to my staff, when applicable.
chrishaislip
 
Posts: 7
Joined: Fri Aug 08th, 2008 9:44am

Re: Mailing Lists Script Needed

Postby jimhill » Wed Sep 17th, 2008 6:30pm

chrishaislip wrote:Jim, that one-line script worked PERFECTLY in my test environment.
Well, it wasn't the most challenging of scripts. Understanding how Mailtraq works is the real key.
chrishaislip wrote:... all I need to do for this script to affect my other distribution lists is to add that distribution lists address to the filter under automatic scripting and that should then apply the script to any message sent to any of my distribution list.
Correct, but, unless it's a typo, your language betrays your misunderstanding of the mail flow in Mailtraq.

Messages TO mailing lists are unaffected by the script because they don't (or, at least, shouldn't) contain the relevant Sender header. Only messages distributed FROM the mailing list should be modified.

Here's a simple flow diagram of how a list input message is handled by Mailtraq
Code: Select all
Mailtraq stores list input message, received either via mail (smtp), webmail (http) or file (.mmsg) in \database\mail\pending.
Mailtraq's inbound router polls the pending folder regularly.
Mailtraq's inbound router (trigger routing) routes the message to your local mailing list.
Mailtraq's mailing list transforms the list input message into a list output message (with multiple recipients in the envelope).
Mailtraq's inbound router (trigger routing) routes the list output message to each of the envelope recipients in one of two ways: local recipients are sent direct to mailbox, remote recipients are sent to \database\mail\outbox.
Mailtraq's outbound router polls the outbox folder regularly.
Hopefully, that demonstrates how important it is to disambiguate messages passing through Mailtraq's inbound router. Given no more than, say, ten or fifteen lists, I'd prefer to create a separate script trigger for each list, filtered to ensure that only that list's output messages are modified. The first time you have to debug some messaging weirdness, you'll appreciate why I'd be willing to do more work to arrive at, ostensibly, the same solution.
chrishaislip wrote:if you have any other useful scripts and/or tools related to Mailtraq, let me know
On my website [url]http://www.rdns.org[/url] you'll find loads of useful scripts and templates as well as other goodies.
chrishaislip wrote: because I am always looking for ways to improve the features or services that an application offers and pass these features on to my staff, when applicable.
Yep, that's the way to do it!
jimhill
Expert User
 
Posts: 337
Joined: Sun Dec 19th, 2004 9:59pm
Location: UK


Return to Mailtraq Scripting

Who is online

Users browsing this forum: No registered users and 2 guests

cron