Recently, both Google and Microsoft have announced the ending of Basic Authentication (User and Password) for their services, including SMTP. This means that you may need to change your applications to use a "more modern" authentication system such as OAuth 2.0.
BVSTools has had this option available for a few years for both Office 365 and GMail. Making the switch from using MAILTOOL Plus and SMTP Basic Authentication to OAuth 2.0 is fairly simple, but will require additional software, licenses, and setup.
*Note: If you are currently using the MAILTOOL ILE functions, please keep in mind the latest version has removed all the hashtag (#) characters from the beginning of the function names. This will need to be updated in programs that use those names. For example - #mailtool_sendMail() is now mailtool_sendMail(). This change was necessary because we had overseas customers where the hashtag wasn't a valid character for them.
G4G - Base Product
G4GSMAIL - Send Mail Addon
GETURI - Used for communications in the background.
G4MS - Base Product
G4MSMAIL - Send Mail Addon
GETURI - Used for communications in the background
When requesting temp keys, just request for G4G and G4MS and you'll get temp keys for everything. Then apply the ones you need. A lot of customers already have GETURI licensed, so if you do, you won't need a key for that. Just G4G and G4GSMAIL and/or G4MS and G4MSMAIL.
1. Register each account you are sending email with using the appropriate command/service (G4GREGSVC and the *G4GSMAIL services or G4MSREGSVC and the *G4MSMAIL service). Here's a video showing the process for Office 365 and here is one for GMail.
2. Change the SENDWITH parameter from *MAILTOOL to *G4GSMAIL for GMail, or *G4MSMAIL for Office 365 on the MAILTOOL command. All the other parameters such as Port, SSL, TLS, AuthUser, and AuthPW are no longer used.
3. The "From" address will be used to match it up with the appropriate registered account.
Or
G4G and G4MS do contain ILE functions that can be used to send emails as well, but using the MAILTOOL command (or ILE Functions) is the easiest.
For more details, see IBM i eMail Solution Paths - In-House, Google/GMail/GSuite, Microsoft Office 365 and Other Providers which has specific examples for each of these options.