MAILTOOL Release Notes

v1.00  - Original

v2.00  - Added ability to email an attachment, such as an HTML file,

          as the body of the message.  This is done specifying the

          special value *ATT for the Message, and then listing the

          attachment(s) you want to use as the body.  All attachment

          files are treated at "text-only" type files when being placed

          into the message body. 

         NOTE:  There is also a new paramter named 

          "Body Content Type (BDYCT)" that should be changed to the 

          appropriate content type.  For example, if you are sending

          an HTML file as the body, or using HTML in the message text,

          this value should be "text/html".

v2.01  - Fixed bug when attaching a file larger than 32k as the body

          of the email.

v2.02  - Internal updates.

v2.03  - Fixed bug when sending attachments.  Attachments could be

          corrupted.

v2.04  - Added logging.  The file MLTLOGPF in the MAILTOOL library

          will keep track of certain parameters when MAILTOOL is used.

         Changed the Subject line from 256 to 1024 characters.

         Changed the Message line from 512 to 4096 characters.

v3.00  - Updated to integrate with SPLTOOL and AFPTOOL.  

         Added ATTNAM (Attachment Name) parameter.  This parameter

          can be used to name the attachment in the email something

          different than the real file name.  Default is to use

          the real file name.

v3.01  - Fixed bug when emailing more than one attachment.  The 

          2nd and latter attachment file names became corrupt.

v3.02  - Changed the limit of attachments from 20 to 50.  If using

          with SPLTOOL you should use at least v8.02 of SPLTOOL.

v3.03  - Allow blanks for attachment names that will be ignored after 

          the first paramter entry.  If attachments are used, the 

          first attachment parameter must be used.  

v3.04  - Removed name of day formatting from date.

v3.05  - Added Importance (IMP) parameter.  Can be used to specify normal,

          high, or low importance.

v3.06  - Added DEBUG parameter.  When *YES is specified, the MIME file used

          to send the email is copied to /tmp/mailtooldebug.txt for viewing.

v3.07  - Updated date routine.  Was causing errors in date when the language

          was non-US.

v3.08  - Added a Mail Disposition Notification (MDN) option.  This allows you to

          specify an email address in which to send a notification when the email

          is received and read.  Please note this is not foolproof and does not

          always work.  This option can be shut off at the client and server levels

          of the receipient.

v3.09  - Updated To: and Content-Disposition: headers.  They weren't including

          quotes around the names if specified which caused problems with some

          email servers.

v3.10  - Updated method of getting MIME file name.  On newer (fast!) machines running

          multiple jobs the MIME header file names could clash.  An update was added 

          to fix this problem.

v3.11  - Added the ability to use the special value *USER for the From Address

          (FROMADDR) parameter.  This will instruct MAILTOOL to use the SMTP name

          from the directory entry of the user the is running the command.

v3.12  - Updated processing to convert to and from addresses to CCSID 500 before

          calling QtmmSendMail API.  This requirement was recently added to the

          IBM documentation for this API.  This update is supposed to fix problems

          that people have with having to use characters other than "@" in their 

          email addresses (for example the § or à characters).

         Updated to retrieve default CCSID instead of job CCSID.

v3.20b - Changed attachment processing... *PLEASE READ*

          If specifying *ATT for the message parameter, this will now ONLY use the

          FIRST attachment specified as the body of the message.  All other attachments

          listed will be treated as normal attachments.

         If you are currently using the *ATT special value for the message body 

          parmeter and are specifying more than one attachment to be the body of the

          message, you will need to update your procedures before applying this

          version of MAILTOOL.

v3.21  - Added the Recipient Separator (RECSEP) parameter.  This is used to specify the

          character to use to separate multiple email addresses.  In the past this was a

          semicolon.  On very few machines this caused problems.  I added this parameter

          and defaulted it to a comma which seems to be the norm with most email clients

          today.

v3.22  - Added double quotes around name or email address (if no name).  Some systems had

          problems with special characters in email addresses if not in quotes.

v3.23  - Added error checking for CPF3C17 that will be returned on V5R2 if a bd

          recipient address is used.

v3.24  - Added option to control the newline characters that are used and solve

          issues on machines not using a US code page.  If \n is not working use

          the following command:

          CRTDTAARA DTAARA(QGPL/MLTNEWLINE) TYPE(*CHAR) LEN(2) VALUE('\n')

          You can then use the \n character for newlines.  If you want to use

          another 2 characters, you can change what is used using the CHGDTAARA

          command.

v3.25  - Added Reply-To parameters.  You can now specify up to 10 addresses that

          will be used for reply to recipients.  If no addresses are specified

          replies will automatically go to sender.  

         NOTE: If you use the Reply-To parameter and want a reply to go to the

          original sender you must include the original sender's address in the

          reply to list.

         If using this version with SPLTOOL, you will need SPLTOOL v8.06 or higher.

         Added parameter to name the debug file.  Defaults to mailtooldebug.txt.  

v3.26  - Fixed bug with timestamp placed in MIME header file.

v3.27  - Fixed debug file parm to be Mixed case instead of MONO.

v3.28  - Fixed bug with attachments over a certain size. (#B64ENCODE error)

v3.29  - Fixed bug with attachments.  Was inserting @@ into files.

v3.30  - Removed use of double quotes around email address when no "name" is specified.  This

          was causing some problems on servers.  NOTE: If you are using any special characters

          in your email address(es) and are experiencing problems, please contact me.  

          Also, be sure to test this version of MAILTOOL before moving it into production

          if you know you are using special characters any email address.

v3.31  - When sending emails with special characters in the subject or message and 

          including an attachment the special characters would be corrupted.  Removed

          the default encoding from the MIME header which caused this problem.

v3.32  - Fixed rare bug when sending attachements as the body of the message.  Trailing blanks

          from buffers were truncated.

v3.40  - **NOTE**

         Updated registration to use Serial Number and Model number.

         Removed nag message from emails in unregistered version.  Instead, temporary 

          keys will be issued to allow unlimited testing for a period of time.

         -- Current Users --

         Email me a note with your serial number(s) and model number(s) before you

          install this version so I can get you a new key.  

         -- New Users --

         Email me and I will get you a temporary key.  This temporary key will allow you

          to use MAILTOOL with all functionality for a limited period of time.  You

          need a temporary key or a permanent key to use MAILTOOL.

         Updated logging portion of application to use system date instead of the

          job date.

v3.41  - Fixed small bug with temporary registration key checking.

v3.42  - Fixed bug with debug paramater.  On versions prior to V4R5 of the OS

          the REPLACE parameter on the CPY command was not valid.  Change processing

          to first remove the debug file if it exists, then create the debug file.

v4.00  - Added MAILTOOL Plus! option as described below.  MAILTOOL Plus! requires

          a seperate registration only for the functionality described below.  If

          you are still using the IBM SMTP server to send emails with MAILTOOL,

          registration of MAILTOOL Plus! is not required.

         -- MAILTOOL Plus! Update --

         Added option to bypass the standard IBM SMTP server for sending of email.

          The new parameter added for this is SENDWITH.  The default value of 

          *IBMSMTP will act as it normally did using the IBM SMTP server to send

          the email message.  The value of *MAILTOOL will use MAILTOOL's own internal

          communications to send the email.  With this option you do not need to have

          MSF or the SMTP server running at all unless it is your only SMTP server.

          The *MAILTOOL option will look up the MX records for the domain of the 

          "from" address to determine which mail server to connect to in order

          to send emails.

         When using *MAILTOOL for the SENDWITH parameter you have the option to

          specify a mail router that can be used if no MX records are successful

          or if you want to only use a mail router.

         Added new parameter for SMTP Debug File (DEBUGSMTP).  When the DEBUG(*YES)

          option is used the file specified will be created to show the communications

          MAILTOOL has with the SMTP servers found on the MX records of the from 

          address.

         ----------------------------

v4.01  - Added the MAILTOOL Plus! Log (MTPLUSLOG) command that will allow you to see

          and work with a log of emails that were not 100% successful in transmission.

          From this display you can display properties of the emails such as the

          recipients and which recipients received the emails and which did not.

          See the MAILTOOL Plus! documentation for more information on this feature:

          http://www.bvstools.com/docs/mailtool/

v4.02  - (SPMT091004) Changed timout for socket from 20 to 30 seconds.

         Fixed bug when reading continued responses from mail server.

v4.03  - Added CCSID parameter that will be used for conversions between

          EBCDIC and ASCII.  This parm is only valid using SENDWITH(*MAILTOOL).

v4.04  - Updated MIME file name creation so that it will only use value from 

          data area.  In the past if the data area wasn't available a timestamp 

          would be used.

v4.05  - Updated MAILTOOL Plus! so that if EHLO command fails HELO is tried for

          compatibility with older systems.

v4.06  - Fixed bug when resending email with MTPLUSLOG command.

v4.07  - Changed conversion method for addresses before calling QtmmSendMail API to

          use iConv() instead of API.

v4.08  - Added processing for MAILTOOL Plus! to look up MX records for the mail 

          router that is specified (if used).

         Fixed bug when trying to connect to servers after the first failed.

v4.09  - Fixed bug that would cause looping on MX servers if the first one

          couldn't be used to send email.

v4.10  - Added MTPBIND parameter to allow user to bind outgoing communications

          when using MAILTOOL Plus! to a specific internal IP address.

v4.11  - Fixed small bug.  MAILTOOL Plus! wouldn't log errors during the message

          portion of the email.  Updated so these errors would be logged in the

          MTPLUSLOG command.

v4.12  - (SP050531) Added processing to handle double quotes for CCSID 1026.

         (SP050615) Added more error reporting for attachment not found errors

         Fixed small bug when using MAILTOOL Plus! and a out of range error occured.

v4.13  - Added more error checking to MAILTOOL Plus! when socket connections are 

          broken.

v4.14  - When using MAILTOOL Plus! and socket error occured previously it would

          simply abort.  Now it will continue to try other mail servers if available.

v4.15  - Updated application so "from" email address would appear correctly in outlook

          when a "from name" was used.

v4.17  - Added Timeout parameter for MAILTOOL Plus

v5.00  - Added distribution lists for MAILTOOL Plus.  Use the MLTDSTL command to 

          work with distribution lists.  To use a distribution list, specify the

          distribution list preceded by a * on the To, CC, or BCC address

          parameters.

v5.01  - Added PLAIN and LOGIN authentication capabilties.  If your mail server

          requires plain or login authentication you can use the new parameters

          AUTHUSER and AUTHPW to enter the userid and password values.

v5.02  - Added PRIORITY parameter that allows a user to set a priority of Urgent,

          Normal or Non-Urgent.

v5.03  - (MT060823) Update on MAILTOOL Plus processing for non-US code pages and

            the @ symbol.

         (MT060823) Update on priority processing.  Added X-Priority header to

            emails for systems that use them.

         (MT060823) Fixed bugs when using MAILTOOL Plus! that could possibly close

            obscure TCPIP ports causing malfunctions in other software

         Added option to send text and html versions of an email.  Both versions

          must be created in the IFS first.  Then for the subject specify the

          special value of *MULTI and specify the two files created in the first

          and second attachment parameters.  The first file must be the text version

          and the second version must be the HTML version.

v6.00  - Registration updates

v6.01  - Registration fix.  If you aquired keys for v6.00 of MAILTOOL, please contact 

          us for new keys for this version.

         (SP070103) Fixed MAILTOOL Plus Authentication.  When sending to multiple 

          recipients with different domains the authentication strings

          would get corrupted.

v6.02  - (MT070103) Fixed MAILTOOL Plus Authentication.  When sending to multiple 

          recipients with different domains the authentication strings

          would get corrupted.

         Added ability to use multiple "names" for TO, CC and BCC Addresses.

v6.03  - Added new parm MXLOOKUP.  This parm is used when using MAILTOOL Plus and

          specifies when you are using a mail router if you want to perform an 

          MX Lookup on the mail router itself.  This fields defaults to *YES so

          it performs as before the addition.

         Added more debugging to debug file for MAILTOOL Plus listing all entries

          used to try and send the email.

v6.04  - Added SENDADDR and SENDNAME parameters to allow the use of the Sender: header.

v6.05  - Added ability to specify a user id for the TO, CC or BCC addresses.  If the user

          id specified has an SMTP address set up in a directory entry, that address

          will be substituted for the user id.

v6.06  - Added SSL Support for MAILTOOL Plus.

         Added parameter to specify SMTP port when using MAILTOOL Plus.

         Updated processing for MAILTOOL Plus so when using USERTR(*ONLY) it doesn't also

          try to send directly.

v6.07  - (v6.06 SP) Removed BCC header from MIME text.

         (v6.06 SP) Fixed bug when running on non-US code page with @ (at) symbol

          in email addresses.

         Added FOOTER parameter to allow user to specify the path to a stream

          file in the IFS to be used as a footer text in the email (for example

          a company disclaimer).

v6.08  - Added options to MAILTOOL Plus distribution lists so you can define

          what "type" of address each entry is in a specific distribution list.

          The valid types are as follows:

           *DFT - Default, which uses the address type that the distribution

            list is specified on (ie, TO, CC or BCC)

           *TO  - The address will always be used as a TO address

           *CC  - The address will always be used as a CC address

           *BCC - The address will always be used as a BCC address

v6.10  - (v6.08 SP) Added colon ":" as a valid character in a recipient email address

          for compatibility with fax email servers.  This option will 

          only work with MAILTOOL Plus when using a mail router that

          is acting as a fax server.

         Added ability to use wildcard in the attachment file name.  The

          valid wilcard methods are wildcard*, *wildcard, and wild*card.

          Examples:

          /myfiles/*.txt

          /myfiles/invoices*.txt

          /myfiles/invoices*

          /myfiles/*

v6.20  - (v6.10 SP) Fixed bug when sending to similar domains would send 

          multiple times to some of the recipients.

         Updated logging.  Instead of a single MLTLOGPF log file, there are 

          now 3 log files.  

          MLTLOGPF - Header information for email

          MLTLOGDPF - Recipient detail information

          MLTLOGAPF - Attachment detail information

          Records can be matched between the files by the "from" email address

           as the email id that is included in each file.

v6.21  - (v6.20 SP) Fixed bug when editing email addresses in MAILTOOL distribution

          lists and getting error that says "Address already exists for list"

         Added command MTPRESEND that will automatically cycle through records

          in the MTPLUSLOG display and try to resend them.

         Some emails that were erroring out when using MAILTOOL Plus were not 

          getting added to the MAILTOOL Plus Log display.  Fixed.

         Added Date/Time to MAILTOOL Plus SMTP Debug file.

         Added object MAILTOOLV type *DTAARA which contains the version of the

          software.

v6.22  - (v6.21 SP) Bug when sending mail with MAILTOOL Plus and get past RCPT command

          but failed after would not log an error.

         (v6.21 SP) Updated MAILTOOL Plus Error log so F12 worked the same as

          F3.

         (v6.21 SP) Fixed bug in mailtoolsmtp.txt file where the last line of the email

          was being concatonated with the next debug description line.

         (v6.21 SP) Added email address to completion message (ie sent to xxxx@xxxxx.xx)

         (v6.21 SP) Changed AUTHPW parm to not show in job log.

         Added NOATTACT (No Attachment Action) parameter that will allow you to specify

          what happens when a wildcard attachment is specified and no files are found.

          The default value of *NONE will act as it did before and send the email, but 

          you also have the option of creating a file named /bvstools/mailtool/noattdft.txt

          that can be used as a default attachment.  This file can contain anything you

          like such as a message saying "no attachments found."

          The value *ERR will tell MAILTOOL to stop and send an error instead of 

          sending the email.

v6.23 -  (v6.22 SP) Updated option 5 (display) from MTPLUSLOG command to use 

          DSPF instead of copying to file in QTEMP and DSPPFM.  The

          DSPF command wasn't available before but now that the min

          release is V5R2 it shouldn't be an issue.

         (v6.22 SP) Fixed bug when specifying *ATT for message along with another

          attachment it would attach the wrong file.

         (v6.22 SP) Fixed bug with wildcard attachments in QDLS file system not 

          working.

         Added new parameters MSGID (Message ID) and MSGIDDOM (Message ID Domain).

          These are used to add message IDs to your emails.  The default is that 

          MAILTOOL will function as it did before, with no message ID.

v6.24 -  Added TLS support for MAILTOOL Plus.  To use TLS instead of SSL, simply

          specify *TLS for the Use SSL parameter.

         SP110811 - Fixed bug when sending emails with invalid attachments it

          a file descriptor was being left open and after a few

          attempts other applications would have errors opening new

          stream files.

         SP111015 - Fixed bug when using Wildcard with QNTC file system.  It

          wasn't picking up any files.

         SP111027 - Fixed bug when MAILTOOL Plus key was invalid the

          MTPLUSLOG file didn't work right to resend email.

         SP120410 - Fixed issue when using Yahoo Mail.  The Base64 conversion

            routing being used was rejected by Yahoo (but not for other

            email clients such as Gmail).

         SP120410b - Same as above, small bug fix

         SP120606 - Found issue when emailing using a distribution list that was

            empty no way to add a recipient.  Added the ability to do this

            using MTPLUSLOG.  Also found bug if emailing an attachment

            the attachment would be corrupt, fixed as well.

         SP121003 - Updated MAILTOOL Plus to give a 10 minute timeout value after

            the DATA portion of the email via RFC 5321

         SP121112b - When *USER is specified as the FROM address and no directory

           entry was found the email was still trying to send.  Added

           more error checking for this case.

          Changed method of looking up directory entry name to use

           system tables.

v7.00  - Added ILE Subprocedures to use to send emails more easily in programs.  See the MAILTOOL documentation

              at http://docs.bvstools.com for more information.

         Fixed a few bugs.

         Changed default debug files so that they use a unique ID number so their are not overwritten each time

           the program is run.  If you have your defaults set to DEBUG(*YES) you can override this by using 

           debug file names that do not include the /%id%/ replacement value.

  If the program errors out, a debug file will be created no matter if debug is turned on or not.  This makes

           things easier to debug as recreating the issue isn't always possible.

         Using configuration files for defaults for ILE subprocedures.  See documentation at http://docs.bvstools.com 

           for more information.

         SP140212 - Fixed bug when sending large attachments and they were corrupted.

            Fixed bug when using wildcard attachments. 

         SP140212b - Fixed bug when using reply to address and it would not clear them

            before sending the next email.

         SP140219 - Fixed bug with timeout value when using ILE functions.

         SP140220 - Added "Close Connection" variable to debug dump.

          Removed MIME data from the SMTP trace debug file.  Replaced with one

           message stating the size of the MIME file.  MIME data is already in 

           it's own file and this will keep the size of the trace files down.

         SP140220b - Fixed bug when sending multiple attachments and the names of the 

            2nd attachment and on were corrupted.

         SP140326 - Fixed bug when mail server was capable of using authentication and

            username was left blank it still tried to use authentication.

         SP140401 - Removed the message saying which configuration file was being used

            when debug was turned off.

         SP140410 - Fixed bug when specifying a distribution list.  Would say either

             there were no recipients or that distribution lists were not 

             valid when not using MAILTOOL Plus (and you were using Plus).

v7.10  - Added Configuration and Save parameters to the MAILTOOL command.  See docs for more 

          info on these new parameters.

         Added the MTPSAVE data area which is a default value for saving emails send using

          MAILTOOL Plus.  See documentation for more information.

         Updated the MTPLUSLOG command so that not only will it show emails that errored, but

          also emails that were sent with the save option (MAILTOOL Plus only).

         Updated the MTPRESEND command with the option to send only errored emails, all emails,

          and also the ability to specify a configuration file to use when sending the emails.

         Added the ability to specify a pre-created MIME file to use when sending the email.  When

          using this information you also will need to make sure you are specifying the recipient

          (ie TO, CC, BCC) addresses.  This applies to MAILTOOL Plus only.

         SP140708 - Updated MTPRESEND to show the number of emails that will be sent if process

            is completed.

           Updated MTPLUSLOG display to show subject and allow viewing of config file

            that is attached to the email.

         SP140714 - Fixed bug when using *ATT as the body any other attachments would be corrupted.

         SP140721 - Fixed bug when job CCSID was non US.  Wasn't recognizing email addresses 

             because the @ sign wasn't being converted.

         SP140722 - Fixed issue with multiple SMTP files.  Made sure it was using the file in 

            QUSRSYS.

           Fixed issue when using a configuration file and an a distribution list entry.

            It would say you can't use them without MAILTOOL Plus because it hadn't yet

            loaded that information from the config file.

         SP140722b- MAILTOOL command was sending completion type error messages instead of escape

            as in previous versions.  Updated so it worked the same as the prior version.

           Updated #mailtool_addAttachment() to return an error message if one exists.  This

            updated the /copy member P.MAILTOOL as well.

           Updated maximum number of attachments to 100 from 50.

         SP140724 - Updated JSON Parsing routine to not ignore data like CR and LF that are in 

            quotes of the data (for newlines in message field in config file).

         SP140728 - Fixed issue with MAILTOOL Plus not recognizing that the server was using

            authentication because the information was sent in separate pieces for each

            option the server allowed.

         SP140804 - Updated the MTPLUSLOG command to allow start date and time to subset the list

            of items.

         SP140805 - Fixed issue when using distribution list and MAILTOOL Plus the MIME header wasn't

            being built correctly in all cases.  Also, the debug file wasn't being removed.

         SP140918 - Fixed bug with CCSIDs and JSON parsing.

         SP140922 - Added return parameter to #mailtool_sendMail that returns the unique email ID.

           Updated #mailtool_sendMail so that it returns the number of recipients the email

            was delivered to when using MAILTOOL Plus instead of zero.  When using

            IBM SMTP this will still return zero when there are no errors.  For both cases

            -1 will be returned when there is an error.

         SP140924 - Fixed issue when sending email and it errored JSON config file that is created

            was the wrong code page/corrupt.

         SP140926 - Fixed bug when message started with an asterisk (*) and it wasn't a special value

            like *ATT it would convert the message to upper case.

         SP141117 - Updated #mailtool_sendMail so that it will always return a unique message ID, even

            when there is an error.

         SP141118 - Fixed bug with the FROM, TO and CC Names getting corrupted in certain instances.

         SP141118b - Temporary directory setting wasn't being used for _debug_ file.  Fixed.

         SP150107 - Fixed bug when sending a blank email address on the command it would try to look up

            a distrubution list entry.  Fixed

         SP150209 - Fixed bug when specifying an extra attachment without a leading / process would                             error.

         SP150210 - Fixed issue when sending with *MAILTOOL and no mail router the TO addresses weren't

            being processed.

v8.00  - Updated to allow the use of OAuth 2.0 for authentication for GMail Accounts.  This will also require

            that G4G and GETURI are also installed and that the *GMAILSMTP server is registered in G4G for

            each user that is using this feature.  GETURI and G4G will also need to be in the library list.

            To specify the use of OAuth 2.0 for authentication use the value *G4G_XOAUTH2 for the SMTP

            Auth User ID paramter and leave the SMTP Auth Password blank.

         SP150226 - Updated application so the special value for the SMTP Auth User of

            *G4MSXOAUTH2 will allow OAuth 2.0 Authentication to be used for

            Microsoft Cloud accounts (such as outlook.com).  This option requires

            G4MS v1.20 or higher and GETURI v4.09 or higher

v8.10  - Updated to use latest version of JSONTOOL JSON Parser for Configuration Files (v3.0).

         Updated configuration file processing when using the MAILTOOL command so that if a 

          configuration file is used any value in the configuration will override the values on 

          the command (if they aren't blank and the values exist in the configuration file).

         Updated the configuration processing so if *DFT is used for the configuration file and not

          a unique name, it will first try to use /bvstools/mailtool/config/<userid>/defaults.json.  If

          that file isn't found it will attempt to use /bvstools/mailtool/config/defaults.json.  Previously

          if a unique name was specified and that file wasn't found it would try using the defaults next.  Now

          if a unique file isn't found it will error out and stop.

         Added data area MLT002DA which will hold the SSL Protocol Version to use.

         Added MLTUPDATE command to make updating from a previous version easier.

         *** Added a procedure named #mailtool_loadDefaults() that can be used when using the ILE subprocedures

          to load defaults from the configuration file set using the configuration_file keyword and 

          #mailtool_setValue().  This is different in that before the #mailtool_init() subprocedure would

          load the defaults.  Now YOU WILL NEED TO UPDATE your PROGRAMS to use the 

          #mailtool_loadDefaults() subprocedure.

         Old Method:

         ===============

         rc = #mailtool_setValue('configuration_file':             

                                 '/bvstools/bvstone_mailtool.json');                

                                                          

         if (#mailtool_init() >= 0);                                

           rc = #mailtool_addTORecipient('bvstone@bvstools.com');  

           rc = #mailtool_setValue('subject':Subject);             

           rc = #mailtool_setValue('message':Message);             

           rc = #mailtool_sendMail(errMsg);                        

         endif;                                                    

         New Method:

         ================                                                          

         if (#mailtool_init() >= 0);                                

           rc = #mailtool_setValue('configuration_file':             

                                   '/bvstools/bvstone_mailtool.json');                

           rc = #mailtool_loadDefaults();

           rc = #mailtool_addTORecipient('bvstone@bvstools.com');  

           rc = #mailtool_setValue('subject':Subject);             

           rc = #mailtool_setValue('message':Message);             

           rc = #mailtool_sendMail(errMsg);                        

         endif;    

         See http://www.fieldexit.com/forum/display?threadid=171 for more details on the

          updates included with this version.

v8.20  - Added #mailtool_setMsgPtr() procedure.  This procedure allows you to set the message

          of the email by specifying a pointer to the message and the length of the message.

          see http://www.fieldexit.com/forum/display?threadid=173 for an example.            

         SP150709 - Fixed bug when using MAILTOOL Plus and no mail router.  If there

          were multiple recipient domains the 1st would work find but the 

          subsequent would not be delivered properly.          

v9.00  - Added licensing by date (SaaS) option.    

         SP151028 - Added option for MAILTOOL Plus to override the host name that is

          sent in the EHLO/HELO conversation.  By default the system host

          and domain is used from CFGTCP option 12.  If you wish to override

          this use the following command:

          CRTDTAARA DTAARA(MAILTOOL/MLTHOSTDA) TYPE(*CHAR) LEN(128) VALUE('<newhost>')

          Replace <newhost> with the hostname you wish to use.      

         SP151113 -Included YAJL objects.

          Fixed bug when configuration file specified doesn't exist.  Now it

           throws an error.

          Updated log so when SSL handshake error happens the return code is

           in the log file.      

v9.10  - Added #mailtool_clearRecipients() subprocedure.  This allows you to clear all,

          TO, CC or BCC recpipients so you can reload them and resend the email.  

v10.00b- Added options to Base64 encode the subject and/or the body of the message. 

          This option was added to handle non-ASCII characters in the subject or

          message body.

          When using these options you'll need to make sure that the CCSID and Code

          Pages used are UTF-8 (1208).  Any attachment, footer or external files must

          have a code page of 1208 in order to work properly.

          The parameters are B64SUBJ and B64MSG.

          The configuration names are base64_encode_subject and base_64_encode_message.

         Updated JSON parsing to use YAJL port.

         Fixed wildcard attachment logging.

         When using *ATT for the message body and a wildcard attachment in the first

          attachment parameter the results may be unpredictable as to which file it

          will use for the body.  It's best to supply a fully qualified name on the

          first parameter and any wildcards following.    

         Chaged CCSID and Code Page defaults from 819 to 1208.        

         SP160216 - Updated Base64 Encoding to use apr_base64_encode API   

         SP160217 - Fixed error when sending with *IBMSMTP when TO and FROM

          were different lengths. 

         SP160218 - Fixed bug when adding attachments and specifying a 

             name for the attached.  Was not using the name.

         SP160219 - Fixed bug when sending attachments the first attachment

            name would be *ATT instead of the file name if an 

            actual filename wasn't provided.

         SP160331 - Added subsetting by Sender Domain in MTPLUSLOG command.

         SP160404 - Fixed issue with non US code pages where the email would be 

            corrupt in some cases using special characters.

         SP160408 - Fixed issue when using Distribution Lists when a CC was before 

             TO in the file.  Caused a display issue with the headers.

         SP160411 - Fixed issue when using wildcard attachements and the default

            no attachment file (noattdft.txt) didn't exit.  An extra

            boundary marker would be put in the email causing some

            clients to show an extra attachment (sometimes named

            att00001.txt or something similar).

         SP160507 - Fixed bug when using OAUTH 2.0 and Outlook.com service.

         SP160509 - Fixed issue when using OAUTH 2.0 and CCSID 1208.

v10.10 - Added Send With (SENDWITH) option to specify *G4MSMAIL in order to send 

          the email using the Microsoft Office 365 Mail API using OAuth 2.0.

          This option requires that the G4MS software (www.bvstools.com/g4ms.html)

          is installed an the G4MSMAIL addon is licensed.

          Note: Not all MAILTOOL parameters will affect the email when sending mail

          using the *G4MSMAIL option.  If there is a parameter not working that

          you wish to use, contact us and we will see if it's possible to add.  

v10.20 - Added logging to MLTLOGPF, MLTLOGDPF and MLTLOGAPF when using the

          SENDWITH(*G4MSMAIL) option.

         Fixed bug when using SENDWITH(*G4MSMAIL) and MESSAGE(*ATT).  If the first

          attachment was blank, but the 2nd wasn't (which was intended to be

          the body) it would throw an error.  Now it will use the first non-blank

          attachment as the body.

         Changed use of YAJLR4 service program to use bindy by copy instead.

         Added Send With Type to MLTLOGPF file to see which method an email was

          sent with.

         Created command MTMRESEND command which is similar to the MTPRESEND command.

          This command allows you to enter a Microsoft ID or the value *ALL in order

          to resend emails in error that were sent with SENDWITH(*G4MSMAIL).

         Created MTG4MSLOG command in order to view and optionally delete or resend

          individual emails that were in error and sent with SENDWITH(*G4MSMAIL).

         Changed requirement of G4MS from v3.00 to v3.10.

         SP160615 - Updated F.MAILTOOL service program to use YAJLR4 as a module

           (bind by copy) instead of service program

         SP160616 - Fixed bug when sending with G4MSMAIL and specifying *ATT for

            the message.  The email was using the 2nd attachment instead

            of the first for the body.

v10.30 - Updated applciation so SENDWITH(*IBMSMTP) will use distribution lists

          in MAILTOOL (MLTDSTL) just like when using MAILTOOL Plus.

v10.40 - Updated to work with G4G v10.20.

v10.41 - Updated to work with G4MS v4.10.

         SP161026b - Updated so that MAILTOOL can be run in "test" mode.  When in 

          "test" mode no emails will be sent.

          To go into test mode create a data area named MLTMODEDA with a

          length of 10 and a value of *TEST.  This data area does not 

          need to reside in the MAILTOOL library.

v10.50 - Updated with the option to turn strict SSL off.  The data area

          named MLTSSL01DA contains the value *YES or *NO depending if 

          you want to ignore most SSL Handshake errors or not.

         SP170112 - Updated so when sending with G4MSMAIL it will process any

          distribution lists specified in any of the recipient

          parameters.

v10.60 - Updated MLTUPDATE so it will use the new library name instead of MAILTOOL

          (in case the library is NOT MAILTOOL).

         Updated option when sending with *G4MSMAIL option that you can now use a

          G4MSMAIL configuration file.  Any settings in the configuration file will

          override any of the paramter values.

         Updated MTPRESEND command.  Added a PROMPT(*YES|*NO) parameter so you can

          bypass the prompt when resending emails. Default is *YES so that it acts

          like it normally did.

         SP170427 - Bug when binding to local IP address.  Fixed.

         SP170428 - Incresed max size of authorization user and password fields

            from 64 to 256 bytes.   

         SP170520b - Added option on MTPLUSLOG command to display email messages

            with errors only. 

         SP170602 - When an email would be sent with MAILRTR(*NONE) and there were

             no MX records to be found for the recipient the FROM address

             in the MTPLOGHPF file would be blank.  Fixed.

10.80  - Updated to latest YAJL objects.

         Renamed YAJL type *SRVPGM to YAJLBVS so it won't interfere with any other 

          versions of YAJL that may be installed.

         Changed default value of MLTSSL01DA from *YES to *NO so that strict SSL is

          off by default.

v10.81 - Updated to work with G4G v11.00 and higher.

v10.82 - Added Return email and name so the Return-Path can be set for each email.

v10.85 - Added Bad Address Action (BADADDACT) paramter on the MAILTOOL command as well

          as bad_address_action settable variable to the ILE functions.

          The value of *DFT for these will use the value in the MLTBADAA data

          area (which defaults to *WARN).

          The value of *WARN will issue a warning about a bad email address

          or invalid or empty distribution list.

          The value of *FAIL will issue an error and stop processing if an 

          invalid email address or invalid or empty distribution list is 

          encountered.

          SP180831 - Added option to use *USER for the From Address when specifying

            *G4MSMAIL as the send with server type and using Office 365

            to send the email

          SP181106 - Changed MLTDSTL to allow mixed case for distribution list name

            since distribution lists are case sensitive.

           Added F12 to Entry List Maintenance screen.

           Updated MLTDSTL so when you're working with an entry and finish

            you will be positioned to the last entry worked with.

           Updated MLTDSTL so when you add a new entry the cursor will be 

            placed on the record just added.

v10.90 - Updated MTPLUSLOG and MTPRESEND commands so if an invalid configuration file

          is entered processing would stop and not remove the entries in the log.

         Added command MTPREBUILD which can be used to rebuild the MAILTOOL error

          log in the case that there is an issue with resending and new entries

          aren't placed in the log file.  This will only work if the MIME files in 

          the IFS still exist in the /tmp directory with the basic naming format.

          Before using this option, please feel free to contact use with questions.

v11.00 - Added the ability to use the IBM Global Security Kit (GSKIT) for SSL/TLS

          communications.  By default MAILTOOL will use the Standard IBM SSL APIs.

          If you update data area MLTSSL02DA to the value of *GSKIT, the GSKIT will

          be used for SSL communications.

         SP190620 - Added configuration file to debug data when using MAILTOOL

           plus.

v11.10 - Added option to use SENDWITH(*G4GSMAIL) to send email using the GMail RESTful

          APIs.  This requires licensing for G4G, G4GSMAIL and GETURI.

         SP191124 - Updated MTG4MSLOG processing program to find the message and

           subject since the labels in the JSON changed when moving to

           the new MS Graph APIs.

         SP200428 - Updated MTG4MSLOG program so that if for some reason YAJL 

           returns an error message with an invalid character we 

           convert it to blank.

v11.20 - Changed service program usage to *DEFER for better performance.

         Updated application so that you can specify the following in a routers

          file to specify to use G4GSMAIL as an option to send emails if a 

          previous method fails:

              {

                "mail_router": "*G4GSMAIL",

                "sequence": nn

              }

         Added more debugging to smtp trace file that is created.

         SP210116A - Added message ID and message ID domain when using send with

           *G4MSMAIL.

         SP210316 - Updated MLT008RG to set commit to none for SQL operations.

v11.30 - Added LSTUNSUB and LSTUNSUBP parameters to MAILTOOL command to allow 

          specifying values for List-Unsubscribe and List-Unsubscribe-Post

          headers.  These can be set using the ILE functions using the #mailtool_setValue()

          function and the list-unsubscribe and list-unsubscribe-post labels.

         Added the option to specify up to 50 user defined headers and values

          using the MAILTOOL command, and up to 100 using the ILE functions.  The

          ILE functions will use the new #mailtool_setUserValue() function.

v11.50 - Updated so if the SSL Handshake error 415 (GSK_ERROR_BAD_PEER) happens, MAILTOOL

          will attempt to resend the email up to 5 times before issuing an error.

         Updated MTPLOGHPF file to include locations of debug files.

         Updated MTPLUSLOG to include the email ID so matching up debug files

          is easier.

         SP211022 - Added more debugging info when there is an error writing

          to the debug file.

         SP211128 - Updated on GSK_WOULD_BLOCK read to ignore error.

v12.00 - Updated ILE functions and removed the leading # (hashtag) from the names 

          for compatibility with other code pages.

         SP220107 - Added subject back to MTPLOGHPF file.  In the past I was leaving

          it blank and retrieving it from the MIME file.

         SP220202 - Added options to MTG4MSLOG command to edit the config file as well

          as view details, such as the full path to the config file.  

          *NOTE - If you choose to edit the config file using option 2 it

           could corrupt the file as it uses the EDTF command.  We strongly

           recommend instead using option 5 to view the full path the the 

           config file and edit it using a proper text editor such as Notepad++.

         SP220330 - Updated MAILTOOL command so when a critical error is reported when

            sending email with *G4MSMAIL that it will cause a hard error in

            MAILTOOL as well so that it can be monitored.  

         SP220713 - When specifying NOATTACT(*ERR) and an attachment wasn't found, 

            MAILTOOL was not throwing an error.  Fixed. 

v12.50 - Added ability to specify send_with_server_type of *G4MSMAIL when using the

          MAILTOOL ILE functions.  This requires G4MS v9.12 or higher.  This method

          uses the g4msmail_sendMailMime() function which at this time (August 2022)

          is limited to 4MB in size (before Base64 encoding).

         When sending with G4G or G4MS with a MIME file added processing that if 

          debug is off to remove the MIME files.

         SP221102 - Updated a few errors that were using the wrong return code

          variable when reporting errors.

         SP221104 - Updated check for Username: and Password: when using user

          authentication.  This was because for some reason the 

          Microsoft Office 365 servers would randomly send the wrong 

          prompt during negotiation.  If it doesn't find the proper 

          prompt it will retry hoping that Microsoft's server sends 

          the proper response.  Yes, I am coding around Microsoft's

          bug.  *shrug*

         SP221109 - Updated code to ignore blank from email addresses if they 

          are in the routers config file.

         SP221129b - Updated objects that work with G4MSMAIL to use the latest version.

          Requires G4MS v9.15 sp221129 or higher.

         SP221129c - Fixed issue with GSK_WOULD_BLOCK error was encountered and RC > 0

          to treat it as a re-read for the operation.

         SP221204 - Updated so that the temp directory would affect the debug and

           trace files instead of always putting them in the /tmp directory.

          Added email ID to job log message.

          Added trace file location to job log if debug is on or the email

           encounters an error using MAILTOOL plus so that we can easily

           find it.  Example:

           Trace file:/tmp/mailtoolsmtp_127721.txt

         SP230223 - Fixed bug in MTPLUSLOG where in some cases resending didn't do 

            anything and reported no errors.

v13.00 - Added ability to redirect emails.  This can be done using the MLTREDIR 

          command which will force redirects system wide or at the command level.  

          See docs for more details.

         SP230329a - Updated so that if you are sending email with G4MS and using a

          footer the footer will be also used in this case.  This will

          required G4MS v9.15 SP230329b or higher which includes

          G4MSMAIL v7.60 or higher to function.