DMail Robots

DSMTP can send a mail message to a program or "robot" for it to do with it as it pleases. Once the message has been given to the robot, DSMTP considers it delivered and, consequently, if the robot cannot be run or does not take the message, DSMTP will bounce the message.

Note: If the robot loses the message it is it's own fault :-) and DSMTP will not notice.

An example of a robot is an autoresponder, which automatically sends a message back to the sender of the message for the recipient. We have provided a version of an autoresponder, called DRespond in the DMail distribution set.

In order to run a robot, you need to create a Special Forward. Typically, you create a forward setting which specifies that a message received by DSMTP should be delivered to a specified robot. In order to let DSMTP know that the message is for a robot, you specify the robots path, starting with the pipe symbol "|" in place of the destination address.

forward john@big.com |drespond.exe

You can turn any mail redirection feature into a 'Special Forward'. So as well as a forward setting you could have an alias file entry "(" alias_file or alias_file_domain) or use a '.forward' file or use the 'fwd=""' field in the response to a user database lookup.

Examples: In order to deliver all mail for john@big.com to an autoresponder called, drespond.exe you might set up an alias like,
john: |drespond.exe
or using the fwd field a user lookup might return,
+OK john@big.com config 0 fwd="|drespond.exe"

Note: in order to include command line arguments for the robot, put the entire command line within quotes, e.g.
forward john@big.com "|drespond.exe arg1 arg2" and all multiple word arguments should also be within quotes, e.g.
forward john@big.com "|drespond.exe "more than one word" arg2"

Aliases and forward rules do not deliver the message to the original recipient, so if you want the original recipient to get the message as well as the robot, you will have to use a forward_cc setting, e.g.
forward_cc john@big.com |drespond.exe or, for an alias or fwd field, use the keyword '$USER' as one of the destinations, e.g.
john: $USER,|drespond.exe
+OK john@big.com config 0 fwd="$USER,|drespond.exe"



Autoresponders - DRespond

An autoresponder accepts a mail message from the SMTP server, analyses who it is for and who it was from and then sends a preset message back to the sender. Often the preset message says something like - "john is on holiday, he will respond to your message when he gets back".

DRespond

DRespond is Netwin's autoresponder robot. We provide it in a ready built form on all platforms. If it is not in your distribution set, please contact DMail support.

Basically, to activate DRespond for a user you should create a forward rule or an alias which pipes the incoming message to drespond, e.g.
In dmail.conf add the following forward rule:

forward bob@domain1.com "|\dmail\drespond.exe \dmail\message.txt -from "postmaster@domain1.com" -subject "AutoResponse:Bob is on holiday." "

will forward any mail for the user bob@domain1.com to drespond which will feed DSMTP an autoresponse message to the sender of the message.

OR, add an alias line like this to an alias file:

bob@domain1.com:    "|\dmail\drespond.exe \dmail\message.txt -from "postmaster@domain1.com" -subject "AutoResponse:Bob is on holiday." "

will forward any mail for the user bob@domain1.com to drespond which will feed DSMTP an autoresponse message to the sender of the message.

OR, in version 2.5d and above, you can enter the robot in the fwd="" field returned by an external authentication module:

+OK username config 0 fwd="destination_address,|c:\dmail\drespond.exe c:\dmail\message.txt -hasheader"
See Ext. Auth. FWD Field for details.

Notes:

  • In all cases, you will need to use the pipe symbol "|" in the destination address.
  • You should include the pipe and all command line arguments within quotes (except for in the Ext. Auth. FWD Field).
  • Multiple word command line arguments should also be within their own quotes (this is not possible when using the Ext. Auth. FWD Field option - you must use the -hasheader argument).
  • If you want the original recipient to receive the message, e.g. if they are on holiday and wish to read all of their mail when they return, then you should use a forward_cc rule instead, i.e. forward carbon copy (when using the Ext. Auth. FWD Field option you can do this by using the $user symbol as a destination address).
  • If you want someone else to deal with their mail while they are away then you should put in a separate forward rule to the other person, e.g.
    forward bob@domain1.com "|drespond.exe . . .
    forward bob@domain1.com fred@domain3.com

    so that fred at domain3.com gets all of bob's mail while he is away, but the autoresponder will answer it too.

Further Details:

DRespond takes a text file as it's main argument. The text within this file is used to form the body of the message to be sent as the autoresponse. If you use the -hasheader option then you can specify the "From:" and "Subject:" headers in the message text file. They should be the first two lines, and then there should be a blank line between them and the message body.

DRespond can be run from the command line, which is a good way to check that it is doing what you require, e.g.

Usage: drespond file.name [-debug] [-hasheader] [-subject "string"] [-from person@domain]

where

file.name

is the name of the file to be used as the response message body (including path relative to the drespond executable if necessary). NB you should include the FULL path.

-debug

causes drespond to create a log file, of executable_name.log, e.g. drespond.log in the same directory that the executable is running from.

-hasheader

tells drespond that the message file (file.name) already has the "From:" and "Subject:" headers in it. If this is not specified, these two headers should be supplied as command line arguments. See below...

-subject "string"

specifies the Subject: header of the response as 'string' if -hasheader is not specified. NB remember to use quotes for mutliple word strings.

-from "string"

specifies the From: header of the response as 'string' if -hasheader is not specified.

NOTE: currently, drespond cannot take a mapped drive path in the message file name on windows NT, e.g. f:\shared\message.txt or \\shared\message.txt do not work. We think that this is a windows NT bug because of the robot being spawned as a sub-process by DSMTP - it works when the robot is run from the command line. If you are more enlightened than us :-) or have got it to work, please contact support-dmail@netwinsite.com and let us know.

Here is an example message text file, file.name, with the "from" and "subject" headers included:
From: postmaster@domainx.com
Subject: The person you emailed is currently on holiday . . .
 
This is the message body, note the blank line above separating it from the message headers and it goes on to say that the person is away until the end of the week but will still get their mail (because you have used a forwarding option where the original recipient gets the message as well as the DRespond robot) and that they will respond to it when they get back.