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:

MAILTOOL Updated to Allow G4GSMAIL as Option in Routers File MAILTOOL Updated to Allow G4GSMAIL as Option in Routers File
Posted by 3 days ago
BVSTools >> BVSTools Announcements >> eMail Tool (MAILTOOL) Specific Announcements
BVSTools Now Offers Interface with Infor's ION APIs BVSTools Now Offers Interface with Infor's ION APIs
Posted by May 15, 2020
BVSTools >> BVSTools Announcements
More V7R4 IFS File CCSID Issues and The Fix More V7R4 IFS File CCSID Issues and The Fix
Posted by March 4, 2020
IBM Power Systems >> (QGPL) IBM i
Error Retrieving IP Address by Name Error Retrieving IP Address by Name
Posted by February 25, 2020
BVSTools >> BVSTools Software Discussion
Logging jobs that hit an outq Logging jobs that hit an outq
Posted by February 13, 2020
Programming >> CL Programming
GreenTools for Google Apps (G4G) v12.60 Released with Shared Drive Features and More... GreenTools for Google Apps (G4G) v12.60 Released with Shared Drive Features and More...
Posted by February 4, 2020
BVSTools >> BVSTools Announcements >> GreenTools for G Suite (Google Apps) (G4G) Specific Announcements
Allowing Requests over Port 80 For SSL Validation (ie, Namecheap, etc) Allowing Requests over Port 80 For SSL Validation (ie, Namecheap, etc)
Posted by January 31, 2020
Programming >> Web Programming
GreenTools for Slack (G4SLK) v3.00 Released GreenTools for Slack (G4SLK) v3.00 Released
Posted by January 17, 2020
BVSTools >> BVSTools Announcements >> GreenTools for Slack (G4SLK) Specific Announcements
Calling a QSH Command from RPG Calling a QSH Command from RPG
Posted by December 26, 2019
Programming >> RPG Programming
SPLTOOL Print Range (PRTRNG) Function Updated to Handle Spooled Files up to 999,999,999 Pages SPLTOOL Print Range (PRTRNG) Function Updated to Handle Spooled Files up to 999,999,999 Pages
Posted by December 14, 2019
BVSTools >> BVSTools Announcements >> Spooled File Tools (SPLTOOL) Specific Announcements
GreenTools for Microsoft Apps (G4MS) Updated to v6.00 - Now Uses Microsoft Graph APIs GreenTools for Microsoft Apps (G4MS) Updated to v6.00 - Now Uses Microsoft Graph APIs
Posted by November 24, 2019
BVSTools >> BVSTools Announcements >> GreenTools for Microsoft Apps (G4MS) Specific Announcements
V7R4 Changes CCSID of Compressed File Using PASE JAR Command - Here's The Fix V7R4 Changes CCSID of Compressed File Using PASE JAR Command - Here's The Fix
Posted by November 21, 2019
IBM Power Systems >> (QGPL) IBM i
Using GETURI to Make OAuth 2.0 Requests - Custom Headers for Access Tokens Using GETURI to Make OAuth 2.0 Requests - Custom Headers for Access Tokens
Posted by November 11, 2019
BVSTools >> BVSTools Software Discussion >> Get URI (GETURI) Specific Discussion
GreenTools for Microsoft Apps (G4MS) v5.00 Released with Updated OneDrive Support and 3rd Party Functionality GreenTools for Microsoft Apps (G4MS) v5.00 Released with Updated OneDrive Support and 3rd Party Functionality
Posted by October 20, 2019
BVSTools >> BVSTools Announcements >> GreenTools for Microsoft Apps (G4MS) Specific Announcements
BVSTools is Now Running V7R4M0 BVSTools is Now Running V7R4M0
Posted by September 28, 2019
BVSTools >> BVSTools Announcements

Reply




Copyright 1983-2020 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).