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:

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

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