bvstone

Setting Defaults for MAILTOOL and SPLTOOL to use MAILTOOL Plus

Posted:

Setting Defaults for MAILTOOL and SPLTOOL to use MAILTOOL Plus

We're often presented with an issue from customers switching from using the standard MAILTOOL command to using MAILTOOL Plus what the best approach is.

A lot of them have hundreds of programs with the MAILTOOL command in them and changing all of them can be daunting to say the least.

There are really two ways to tackle this:

The Change Command Default (CHGCMDDFT) Command and MAILTOOL Plus Parameters

Well, since MAILTOOL (and SPL2EMAIL if you're using that) are commands, then you can use the good old Change Command Default (CHGCMDDFT) command to change the defaults for the appropriate parameters.  (Of course, if you've hard-coded these in the programs this won't work and you'll need to go through each program and fix things.)

The following command will change the defaults for MAILTOOL (and SPLTOOL) to use MAILTOOL Plus as the default.  If you also require the use of SSL/TLS and/or userid and password, those parameters also can be changed.

//========== MAILTOOL ============

CHGCMDDFTCMD(MAILTOOL) NEWDFT('SENDWITH(*MAILTOOL)')
CHGCMDDFTCMD(MAILTOOL) NEWDFT('MAILRTR(''xx.xx.xx.xx'')')
CHGCMDDFTCMD(MAILTOOL) NEWDFT('USERTR(*ONLY)')

// For Gmail, Office 365, or other servers that require SSL, TLS, And Authentication:
CHGCMDDFT CMD(MAILTOOL) NEWDFT('SSL(*TLS)')  //*YES = SSL, *TLS = TLS
CHGCMDDFT CMD(MAILTOOL) NEWDFT('PORT(587)')  //Normally 465 for SSL or 587 for TLS
CHGCMDDFT CMD(MAILTOOL) NEWDFT('AUTHUSER(''<userid>'')') 
CHGCMDDFT CMD(MAILTOOL) NEWDFT('AUTHOW(''<password>'')')

//========== SPLTOOL ============
CHGCMDDFTCMD(SPL2EMAIL) NEWDFT('SENDWITH(*MAILTOOL)')
CHGCMDDFTCMD(SPL2EMAIL) NEWDFT('MAILRTR(''xx.xx.xx.xx'')')
CHGCMDDFTCMD(SPL2EMAIL) NEWDFT('USERTR(*ONLY)')

CHGCMDDFTCMD(SPL2EMAILB) NEWDFT('SENDWITH(*MAILTOOL)')
CHGCMDDFTCMD(SPL2EMAILB) NEWDFT('MAILRTR(''xx.xx.xx.xx'')')
CHGCMDDFTCMD(SPL2EMAILB) NEWDFT('USERTR(*ONLY)')

// For Gmail, Office 365, or other servers that require SSL, TLS, And Authentication:
CHGCMDDFT CMD(SPL2EMAIL) NEWDFT('SSL(*TLS)')
CHGCMDDFT CMD(SPL2EMAIL) NEWDFT('PORT(587)')
CHGCMDDFT CMD(SPL2EMAIL) NEWDFT('AUTHUSER(''<userid>'')')
CHGCMDDFT CMD(SPL2EMAIL) NEWDFT('AUTHOW(''<password>'')')

CHGCMDDFT CMD(SPL2EMAILB) NEWDFT('SSL(*TLS)')
CHGCMDDFT CMD(SPL2EMAILB) NEWDFT('PORT(587)')
CHGCMDDFT CMD(SPL2EMAILB) NEWDFT('AUTHUSER(''<userid>'')')
CHGCMDDFT CMD(SPL2EMAILB) NEWDFT('AUTHOW(''<password>'')')

Once done, all the commands that don't have SENDWITH, MAILRTR and USERTR defined will now use these new defaults.

One thing to look out for is if you do upgrade versions of MAILTOOL or SPLTOOL, the commands will default back to their original values and these commands will need to be run again.  That's just how things work with IBM commands.

Using Configuration Files and CHGCMDDFT

Another option is to use configuration files to set these values.  You could create a default configuration file to be used and use the CHGCMDDFT command again to the value of that configuration file.

CHGCMDDFT CMD(MAILTOOL) NEWDFT('CONFIG(''/path/myconfigfile.json'')')

CHGCMDDFT CMD(SPL2EMAIL) NEWDFT('CONFIG(''/path/myconfigfile.json'')')

CHGCMDDFT CMD(SPL2EMAILB) NEWDFT('CONFIG(''/path/myconfigfile.json'')')

Now, the configuration file you're using can specify a value in the configuration file for pretty much any other parameter on the command (except the recipients, subject, message and attachments).   This means setting the mail router, send with, use router, smtp user id and password, SSL/TLS settings, etc are all there in a simple JSON file.

In the long run, this is probably the best option as the configuration files really make updating settings for the commands simple and straightforward.

We STRONGLY recommend putting these commands (with the proper values) in a CL so that if you run into issues you can reset these defaults.  

For example, if you install a new version of SPLTOOL or MAILTOOL, this will reset these defaults.  So, after a version update, simply run this command again to reset them to the values required by your organization.

Another example would be if you need to change the from address, authorization user and/or password.  Then you would simply change the values in the CL, compile the CL, and run it so the new values are used. 

 


Last edited 12/05/2017 at 09:20:26



Latest Posts:

GreenTools For G Suite (G4G) v12.00 Released With Base OAuth 2.0 Functionality GreenTools For G Suite (G4G) v12.00 Released With Base OAuth 2.0 Functionality
Posted by July 28, 2019
BVSTools >> BVSTools Announcements >> GreenTools for G Suite (Google Apps) (G4G) Specific Announcements
BVSTools Small Price Increase in 2020 BVSTools Small Price Increase in 2020
Posted by July 26, 2019
BVSTools >> BVSTools Announcements
GreenTools for Vertex Cloud (VTXCLOUD) Now Available GreenTools for Vertex Cloud (VTXCLOUD) Now Available
Posted by July 22, 2019
BVSTools >> BVSTools Announcements >> GreenTools for Vertex Cloud (VTXCLOUD) Specific Announcements
GreenTools for Google Apps (G4G) - Drive Addon Successfully Verified by Google GreenTools for Google Apps (G4G) - Drive Addon Successfully Verified by Google
Posted by July 22, 2019
BVSTools >> BVSTools Announcements >> GreenTools for G Suite (Google Apps) (G4G) Specific Announcements
Why I Cancelled my DynDNS Service and How I Replaced It with an IBM i Application Why I Cancelled my DynDNS Service and How I Replaced It with an IBM i Application
Posted by July 17, 2019
IBM Power Systems >> (QGPL) IBM i
Green Tools for G Suite (G4G) Product Updates (Licensing, Functionality, Base Product) Green Tools for G Suite (G4G) Product Updates (Licensing, Functionality, Base Product)
Posted by July 13, 2019
BVSTools >> BVSTools Announcements >> GreenTools for G Suite (Google Apps) (G4G) Specific Announcements
Reading JSON Data from Standard Input With YAJL and RPG Reading JSON Data from Standard Input With YAJL and RPG
Posted by July 12, 2019
Programming >> Proof of Concept (POC)
MAILTOOL Updated to Allow Use of IBM Global Security Kit (GSKIT) for SSL/TLS Communications MAILTOOL Updated to Allow Use of IBM Global Security Kit (GSKIT) for SSL/TLS Communications
Posted by June 19, 2019
BVSTools >> BVSTools Announcements >> eMail Tool (MAILTOOL) Specific Announcements
GETURI v10.00 Released Supporting IBM Global Security Kit (GSKIT) and Server Name Indication (SNI) GETURI v10.00 Released Supporting IBM Global Security Kit (GSKIT) and Server Name Indication (SNI)
Posted by June 11, 2019
BVSTools >> BVSTools Announcements >> Get URI (GETURI) Specific Announcements
BVSTools Now Offers Vertex Cloud Interface BVSTools Now Offers Vertex Cloud Interface
Posted by April 15, 2019
BVSTools >> BVSTools Announcements
Token Has an Invalid Signature Error for Office 365 Email Token Has an Invalid Signature Error for Office 365 Email
Posted by March 22, 2019
BVSTools >> BVSTools Software Discussion >> GreenTools for Microsoft Apps (G4MS) Specific Discussion
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

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).