Command Line Interface

 

The command line interface to AutoMSW lets you use the power of AutoMSW from a command prompt, batch files, macros, and other situations when you prefer to not use the regular graphical user interface.

 

Trial Period:

The command line interface is available to try out in any version of AutoMSW, but to use the command line interface past the trial period a Professional level license is required.  The trial period of the command line interface is 20 successfully completed jobs.

 

Running AutoMSW from a Command Line:

To use the command line interface call the AutoMSW program with the /file option and the filename of an "arguments file".  An arguments file is a text file that contains instructions on how to run this job.  An example command line would be:

"C:\Program Files (x86)\AutoMSW\automail.exe" /file "C:\Users\John\Documents\AutoMSW\cloptions.txt"

This example specifies the full path and filename of both the AutoMSW executable and the arguments file.  If your path or filename contains spaces put the whole path and filename in double quotes.  The double quotes are not required if you don't have spaces in the path or filename.  You could also run it like:

automail.exe /file cloptions.txt

if the command is being run from the same folder as the executable and the arguments file.  (You may also make use of the PATH environment variable.  Consult your Windows documentation).  For an example batch file showing how to run AutoMSW and process any error values returned see the "Sample.bat" file in your AutoMSW folder.

 

Arguments File:

The arguments file passed in on the command line is a plain text file.  A sample arguments file called "cloptions.txt" is included in your AutoMSW folder.  The following commands are available for use in your arguments file:

 

Send Method

Set to a number 1, 2, or 3:

1 = Direct Send
2 = SMTP Mail Server
3 = MAPI

Direct From

The 'From' e-mail address when using the Direct Send method

SMTP From

The 'From' e-mail address when sending through an SMTP mail server

SMTP Server

The SMTP mail server name to use when sending through an SMTP mail server

SMTP Authentication

Set to 1 to use authentication, or 0 when authentication is not needed.  Use when sending through an SMTP mail server.

SMTP Username

The username to authenticate with when sending through an SMTP mail server

SMTP Password

The password to authenticate with when sending through an SMTP mail server

SMTP Port

Specify the port number when connecting to the SMTP server.  Use -1 for the default port, or specify any other desired port number.

SMTP SSL

Set to a number 0, 1, or 2:

0 = do not use a secure connection to the SMTP mail server
1 = use a SSL connection to the SMTP mail server
2 = use a TLS connection to the SMTP mail server

Subject

The subject to use for your messages.  The subject can optionally contain mail merge fields.

Mail List

Specify the full path and filename of the mailing list file.

Text Message

Specify the full path and filename of the plain text version of the message.

HTML Message

Specify the full path and filename of the HTML version of the message.

Use HTML

Set to either 1 (use HTML) or 0 (plain text)

Clear Attachments

Setting this to any value removes any currently set global attachments.  Use this before AddAttachment to ensure only the attachments you specify are attached.  If this is not specified, any attachments specified through the graphical user interface will also be attached.

AddAttachment

Specify the full path and filename of a global attachment.  This command can be used multiple times to specify multiple global attachments.  (Wildcards * and ? are supported.)

DKIM_enable

Set to 1 to add a DKIM signature to outgoing mail

DKIM_selector

Specify the "Selector" value for DKIM signature

DKIM_keyfile

Specify the full path and filename of the private key file to use for DKIM signature

Seconds Pause

Specify how many seconds to pause between sending each e-mail

Threads

Specify the number of threads to use when sending

Retry

Specify the number of times to re-try sending e-mails that couldn't be sent in the previous pass

Custom<#>_FieldName
Custom<#>_FieldBody

Specify optional custom message header fields (name and body values).  Can specify up to 5 custom header fields.  Replace <#> with a number between 1 and 5.

 

All commands are optional in the arguments file.  If a command is not present the default value will be used.  The default values are the values that were last set through the graphical user interface.  An example arguments file is shown here:

#
# From
# How your emails are sent, and from where

#
Send Method: 1

Direct From: "ACME Sales" <sales@mydomain.com>
 


#
# Subject
# The subject of your messages
#
Subject: New Product Announcement for [[Name]]


#
# Mail List
# Specify the full path and filename of the mailing list file
#
Mail List: C:\Data\ProductABC\Mailing Lists\testlist.txt


#
# Text Message and HTML Message
# Specify the full path and filename of the message file(s)
#
Text Message: C:\Data\ProductABC\Notification Letters\Announce.txt
HTML Message: C:\Data\ProductABC\Notification Letters\Announce
.html


#
# Use HTML
#
Use HTML: 1

 

 

#

# Use DKIM

#

DKIM_enable: 1

DKIM_selector: dkim

DKIM_keyfile: C:\Private_Keys\mydomain.key


 

#

# Use a Custom Header for List-Unsubscribe

#

Custom1_FieldName: List-Unsubscribe

Custom1_FieldBody: <mailto:unsubscribe@mydomain.com>


 

#
# AddAttachment
# This command can be used multiple times to add additional global attachments

# You can also use wildcards (* and ?) in the filename
#

Clear Attachments: 1
AddAttachment: C:\Data\ProductABC\Notification Letters\specs.pdf
AddAttachment: C:\Data\ProductABC\Notification Letters\specs.doc

AddAttachment: C:\Data\ProductABC\Invoices\*.txt
 

 

Return Values:

AutoMSW returns one of the following values upon completion:

 

0

Job Completed Successfully

1

Job Failed: Unknown Error

2

Job Failed: Syntax Error On Command Line

3

Job Failed: Couldn't Open Arguments File

4

Job Failed: Missing Backslash Error

5

Job Failed: Trial Period Expired

6

Job Failed: Invalid License, Contact us...

7

Job Failed: Memory Allocation Error

8

Job Failed: Failed To Open Current Job Log

9

Job Failed: Failed To Open Historical Job Log

10

Job Failed: Failed To Open Mailing List

11

Job Failed: Failed To Find Email Column In Mailing List

12

Job Failed: Failed To Open Failed List Log

13

Job Failed: Failed To Open Failed List With Reason Log

14

Job Failed: Failed To Open Sent List Log

15

Job Failed: Bad Syntax On AddAttachment Statement

 


AutoMSW Home