Mailtraq - the Complete Email Server

Enstar for Mailtraq email server sales & support
Making world-class Internet technology affordable  

Search for:

Advanced search

KB04101401 Send message to all local users

Preferred Method

Using the Mailing List to Mail Group feature

Mailtraq 2.12 introduced the ability to add Console Mail Groups and Directory LDAP searches to Mailing Lists, making it simple to send messages to local users without constantly updating the subscriber list.

See for more information and Configuration Tips


Alternate Methods

Method 1 - suitable for smaller installations

A simple way to send messages to all local users is to use the mailbox 'Alias' feature (described here). Aliasing each user to a common mailbox called, for example <everyone> makes it simple to send a message to one address which will be received by everyone.
If you wish, you can use Mail Filters to control who is allowed to send a message to this common mailbox.

Method 2 - suitable for any sized installation

A more comprehensive, script based technique makes it possible to send an email to all the local users in Mailtraq without having to make a mailinglist and then populate (and maintain) it manually.

This is done by using a Mailtraq Script. You will find a copy of the script here:


and it is also provided at the bottom of this page.

Method 2 'How-to'

First copy the script to the location specified in the Title
header, in this case \scripts\msg2all.mtq

To register the script in Mailtraq, go to Console | Options |
Scripts and Templates | Automated Scripting tab. Click on Add and
select the "New Event" entry in the Description column. Click on
Properties and complete as follows ...

Script Properties tab
  [ x ]  Enable this Script
  Description  [ Messages to all users ]
  Script/Plug-in to Execute  [ msg2all ]
  [   ]  Disable after execution
  Script Trigger  [ Message Trigger ]

Message Trigger tab
  ( x )  Filtered
  (   )  All Messages
  Execute script during  [ Inbound Mail Delivery ]
  [ x ]  Script will modify the message

Then click on the Filter button and complete as follows ...

Filter Settings tab
  Filter Criteria  [ To  ]
  Filter Value  [ all-users@your.domain ]
  Match  [ Any ]

... substituting the string "your.domain" with Mailtraq's Domain
Name (Console | Options | Server | Server tab).

Ok back out to the Console and you've finished registering the
script in Mailtraq.

Before you can send a test message, you need to modify one
parameter in the script itself. Open msg2all.mtq in your text
editor (notepad will do) and change this line ...

all_pass := "[some password]";

... so that it contains a password of your choosing, for example
you might use ...

all_pass := "[abcdefg]";

Save the changes to the script file. You will see a number of
other variables there which you can modify, if necessary, once
you have the basic script working correctly.

Now, when you send your test message, it needs to be created as
follows ...

| From: John Smith <>
| To: all-users@your.domain
| Subject: [abcdefg] Message to all users

The address in the To header is mandatory as is the [pass] tag at
the beginning of the Subject header - if you don't have the
correct To header, the script filter won't trigger; if you don't
have the [pass] tag, the script will reject your attempt as

Everything else, including the rest of the Subject header, is
entirely up to you. The script will strip your password tag from
the message before it's distributed so that you remain in control
of who is allowed to send messages to all-users.

This script was provided by Jim Hill, an authoritative Mailtraq user.

// Title   - Messages to all users (\scripts\msg2all.mtq)
// Author  - Jim Hill
// Date    - June 2002
// Trigger - Message: Inbound Mail
// Filter  - To: all-users@your.domain
// Match   - Any

// specify pass phrase in Subject header
all_pass := "[some password]";

// specify comma separated list of mailboxes to exclude
all_ex := "postmaster,unknown,abuse";

// specify destination for unauthorised message attempts
all_fail := "postmaster";

// force Reply-To header?
all_reply := "TRUE";

// specify Reply-To address
all_repto := "postmaster";

// -- do not alter below this line --

// initialise variables
all_slots := "";
all_boxes := "";
all_rcpts := "";

// extract key from Subject and verify
all_send := all_pass = WildcardMatchReplace(Header("Subject"), "[*]*", "[$1]");

Write(a, "Subject verified = " ++ all_send);

// if verified, compile mailslot list
    all_slots := GetMailBoxes(),
    For(all_slots, "slot",
      If(GetMailboxProp(slot, "Type") = "mailbox",
        all_boxes := If(Length(all_boxes) > 0, all_boxes ++ ",") ++ slot

// if verified, remove exclusions
  For(all_boxes, "box",
      inc := "TRUE",
      For(all_ex, "ex", If(box = ex, inc := "FALSE")),
      If(inc, all_rcpts := If(Length(all_rcpts) > 0, all_rcpts ++ ",") ++ box)

// if verified, remove pass and add recipients
// if unverified, route as failed message
    SetHeader("Subject", WildcardMatchReplace(Header("Subject"), "*" ++ all_pass ++ "*", "$1$2")),
    If(all_reply, SetHeader("Reply-To", "<" ++ AddressOf(all_repto) ++ ">"))


Keywords: kb ticker general
Mailtraq Highlights...
 SMTP Server     Mailtraq SMTP email server video IMAP Server     Mailtraq IMAP email Server video
 POP3 Server     Mailtraq POP3 email server video Proxy Server     Mailtraq proxy email server video
 Webmail Server     Mailtraq webmail email server video Mailing-list Server     Mailing list email server video
 Groupware Services     Mailtraq groupware email services video Spam and Virus control     Spam and virus control email server video


   Copyright © 2003 - 2011 Enstar Ltd, Enstar LLC & Fastraq Ltd. All rights reserved. Privacy policy.
   Mailtraq® is a registered trademark of Fastraq Limited.