bvstone

Using Multiple Mail Routers with MAILTOOL During Transition to Cloud Server

Posted:

Using Multiple Mail Routers with MAILTOOL During Transition to Cloud Server

I was recently contacted by a customer asking if MAILTOOL could use more than one mail router.  We recently did update MAILTOOL to handle multiple routers in the case of failure of one, but in this case the reason was that they were moving from a locally hosted Microsoft Exchange server to a Cloud Hosted Server, in this case Office 365.

Because MAILTOOL not only has the ability to set it's values at a command level but also at a system and/or user level using configuration files, this is fairly simple to accomplish.

1.  Create a default configuration file in /bvstools/mailtool/config/defaults.json.  This will contain the settings for the Microsoft Exchange server:

{
	"variables": [
	{
		"name":"send_with_server_type",
		"default":"*MAILTOOL"
	},
	{
		"name":"mail_router",
		"default":"<exchange.router.host.or.ip>"
	},
	{
		"name":"use_mail_router",
		"default":"*ONLY"
	},
  ]
}

 

Replace <exchange.router.host.or.ip> with your mail router information.  

This setup is used in the case where your Microsoft Exchange server does not require any type of authentication.  If it does, please feel free to contact me for more options.

2.  For each user you switch over to Office 365, set up a configuration file for that user id in /bvstools/mailtool/config/<USERID>/defaults.json where <USERID> is the specific user id.

That file would look like this:

{
	"variables": [
    {
		"name":"from_email",
		"default":"<from email address>"
	},
	{
		"name":"from_name",
		"default":"<user name>"
	},
	{
		"name":"send_with_server_type",
		"default":"*MAILTOOL"
	},
	{
		"name":"mail_router",
		"default":"smtp.office365.com"
	},
	{
		"name":"use_mail_router",
		"default":"*ONLY"
	},
	{
		"name":"perform_mx_lookup",
		"default":"*NO"
	},
	{
		"name":"use_ssl",
		"default":"*TLS"
	},
	{
		"name":"smtp_port",
		"default":"587"
	},
	{
		"name":"smtp_auth_user",
		"default":"<from email address>
	},
	{
		"name":"smtp_auth_password",
		"default":"<account password>"
	}	
  ]
}

Again, anything in < > replace with the appropriate data.

Because Office 365 requires authentication you will need a configuration file for each user since each account will have different authentication data.

There is another option for using Office 365 that uses OAuth 2.0.  With this method you don't have to store the password for the user, but there is a small setup for each user account.  And it also requires licensing of addition software.

3.  Turn off Strict SSL for MAILTOOL. 

Turning off Strict SSL for MAILTOOL is done by copying and pasting the following command:

CHGDTAARA DTAARA(MAILTOOL/MLTSSL01DA *ALL) VALUE(*NO)

We could instead import the proper Certificate Authorities (CAs), but lately MS has been pretty flaky with their SSL certificates.  Feel free to contact me for information on how to import the CAs.

4.  Set up the MAILTOOL command to use the configuration files by default. 

This is done by copying and pasting the following command:

CHGCMDDFT CMD(MAILTOOL) NEWDFT('CONFIG(*DFT)') 

What this does is set the default for Configuration File on the MAILTOOL command so that it will use the default (*DFT).  The default is first looking for /bvstools/mailtool/config/<USERID>/defaults.json and if that's not found it will use /bvstools/mailtool/config/defaults.json.

If you are also using SPLTOOL and the SPL2EMAIL or SPL2EMAILB command you will want to change the defaults for the Configuration File parameter on them as well.

Remember that any field in the configuration file will automatically override those on the command, so the parameters mentioned here aren't the only ones you need to use, but they are the minimum that you will want to use.

 




Latest Posts:

Resending Emails that have Errored Out with Updated Router or Authentication Information Resending Emails that have Errored Out with Updated Router or Authentication Information
Posted by March 1, 2019
BVSTools >> BVSTools Software Discussion >> Email Tools (MAILTOOL) Specific Discussion
BVSTools Offers Toolset to Work With HubSpot OAuth 2.0 APIs On Your IBM i BVSTools Offers Toolset to Work With HubSpot OAuth 2.0 APIs On Your IBM i
Posted by January 27, 2019
BVSTools >> BVSTools Announcements
G4MSDRV Currently Not Supported G4MSDRV Currently Not Supported
Posted by January 17, 2019
BVSTools >> BVSTools Announcements >> GreenTools for Microsoft Apps (G4MS) Specific Announcements
Removing Trailing Carriage Returns and/or Line Feeds from a String with RPG Removing Trailing Carriage Returns and/or Line Feeds from a String with RPG
Posted by December 26, 2018
Programming >> RPG Programming
Create QRCODE in DDS Create QRCODE in DDS
Posted by September 21, 2018
Programming >> RPG Programming
Base64 Encoding a File with RPG Base64 Encoding a File with RPG
Posted by September 6, 2018
Programming >> RPG Programming
Building JSON with RPG and YAJL and Writing to Standard Output Building JSON with RPG and YAJL and Writing to Standard Output
Posted by August 31, 2018
Programming >> Proof of Concept (POC)
How to Delete Files or Empty Trash From Your Google Drive with your IBM i and RPG/ILE How to Delete Files or Empty Trash From Your Google Drive with your IBM i and RPG/ILE
Posted by July 24, 2018
BVSTools >> BVSTools Software Discussion >> GreenTools for G Suite (Google Apps) (G4G) Specific Discussion
GreenTools for G Suite (G4G) Updated to Include Delete and Empty Trash Function GreenTools for G Suite (G4G) Updated to Include Delete and Empty Trash Function
Posted by July 24, 2018
BVSTools >> BVSTools Announcements >> GreenTools for G Suite (Google Apps) (G4G) Specific Announcements
What to Do If Your License Keys Don't Work What to Do If Your License Keys Don't Work
Posted by July 18, 2018
BVSTools >> BVSTools Software Discussion
MAILTOOL Updated to Allow Failed Message on Invalid Recipient MAILTOOL Updated to Allow Failed Message on Invalid Recipient
Posted by May 20, 2018
BVSTools >> BVSTools Announcements >> eMail Tool (MAILTOOL) Specific Announcements
Non HTTPS Callbacks Removed from GreenTools for G Suite (G4G) Non HTTPS Callbacks Removed from GreenTools for G Suite (G4G)
Posted by April 15, 2018
BVSTools >> BVSTools Announcements >> GreenTools for G Suite (Google Apps) (G4G) Specific Announcements
IBM i Related Survey Available IBM i Related Survey Available
Posted by April 7, 2018
IBM Power Systems >> (QGPL) IBM i
BVSTools Releases Braintree Webhook Open Source Application - Node.js BVSTools Releases Braintree Webhook Open Source Application - Node.js
Posted by April 5, 2018
Programming >> Open Source
BVSTools Now Offering Web Services (BETA) BVSTools Now Offering Web Services (BETA)
Posted by April 3, 2018
BVSTools >> BVSTools Announcements

Reply




Copyright 1983-2019 BVSTools
GreenBoard(v3) Powered by the eRPG SDK, MAILTOOL Plus!, GreenTools for Google Apps, jQuery, jQuery UI, BlockUI, CKEditor and running on the IBM i (AKA AS/400, iSeries, System i).