Prolateral Consulting Ltd
Prolateral Consulting Ltd
Support
Support
Knowledgebase Articles
Help
Setup examples
Support

Prolateral offers primary and backup domain (DNS) services, with servers in key geographic locations providing the best service possible.

Problem

How to send emails with SwithMail cli using outMail?

Solution

Follow the guide below to send emails using the command line tool SwithMail for Microsoft Windows. More detailed information on SwithMail usage and parameters can be found at www.tbare.com/software/swithmail [Disclaimer - 3rd party link]

This article already assumes your Windows system is working, has suitable Internet access, and you have the nessecery permissions to run applications in a command prompt.  It is also assumed you have downloaded the SwithMail application.

For this KB article the SwithMail folder has been placed in C:\SwithMail

Method 1

SwithMail is a command line tool and for this example we are going to use the following command line switches

ParametersValue
/S Silent mode to prevent the Windows dialog showing (/S or /Silent)
/From The From Address (fred@example.com)
/To The To Address (barny@example.com)
/Sub Subject line of the email
/Body Message body
/Server The address of the outMail server (mxXXXXXX.smtp-engine.com)
/Port If you wish to use an alternative port other than SMTP TCP 25 (See your welcome email for available alternative ports)
/Username Your outMail username
/Password Your outMail password
/tls We will use TLS in this example. However /TLS and /SSL are supported with outMail sending
/Log We will output to a log to see the results

The example command line will look like the below

C:

CD \SwithMail

SwithMail.exe /S /From "fred@example.com" /To "barny@example.com" /Sub "Test" /Body "Hi.. This is a test" /Server mxXXXXXX.smtp-engine.com /Port 25 /Username "outmailUsername" /Password "outmailPassword" /tls "true" /log "C:\SwithMail\log.txt"

Windows Command Prompt showing SwithMail cli sending an email with outmail

To check the result of the email send please check the log file, in this example its C:\SwithMail\log.txt.

Example of the log is below

DD/MM/YYYY HH:MM:SS - Success - SendTo: "barny@example.com" - CC: "" - BCC: "" - Subject: "Test"

 

Method 2

The second solution is rather than specify all the parameters on the command line you can save the settings in a XML file.

Run the program SwithMail.exe and click on the button "Configure Settings with GUI"

Swithmail main winform

In the Server Settings section configure "Mail Server" field (using your assigned outMail server, e.g. mxXXXXXX.smtp-engine.com). Check the box "Different Username" and in the "Username" field enter the outmailUsername. Likewise in the "PW" field enter the outmailPassword.  For the "Port" field enter 25 or any of the other outMail alternative ports. "TLS/SSL" is optional.

For the purposes of this example we have also completed the From Address details.

swithmail configure email settings server settings

For testing purposes we also configured the log settings in the "XML / Parameters / Log" section

swithmail configure email settings log settings

Once we have finished setting all the fields click the "Save to XML" button.

swithmail save to xml button

The SwithMail command line tool will now be used with the setting in the XML file and the following command line switches

ParametersValue
/S Silent mode to prevent the Windows dialog showing (/S or /Silent)
/XML Location of the XML file
/To The To Address (barny@example.com)
/Sub Subject line of the email
/Body Message body

The example command line will look like the below

C:

CD \SwithMail

SwithMail.exe /S /XML "C:\SwithMail\SwithMailSettings.xml" /To "barny@example.com" /Sub "Test" /Body "Hi.. This is a test" 

Windows Command Prompt showing SwithMail cli sending an email with outmail

To check the result of the email send please check the log file, in this example its C:\SwithMail\log.txt.

Example of the log is below

DD/MM/YYYY HH:MM:SS - Success - SendTo: "barny@example.com" - CC: "" - BCC: "" - Subject: "Test"

 

Problem Solving

Below is a list of common gotchas.

Relay access denied

You need to check you're passing the correct parameters.  Remember outMail is a SMTP authenticated service. Double check your outMail SMTP credentials (username and password). Both are case sensitive.

ParametersValue
/Server The address of the outMail server (mxXXXXXX.smtp-engine.com)
/Username Your outMail username
/Password Your outMail password

 

Summary of server details

Outgoing server

mxXXXXXX.smtp-engine.com

As provided in your signup email.

Outgoing server protocol

SMTP

Outgoing server port

25, 465, 587, 2525 or 8025

Authentication Type

Basic Authentication, SSL and TLS supported

Username

As provided

Password

As provided

 

like it, love it, then share it. Share this article on social media.

Did you enjoy this article?

Disclaimer

The Origin of this information may be internal or external to Prolateral Consulting Ltd. Prolateral makes all reasonable efforts to verify this information. However, the information provided in this document is for your information only. Prolateral makes no explicit or implied claims to the validity of this information. Any trademarks referenced in this document are the property of their respective owners.