We have been able to send email from our IBM i partitions for several releases, using IBM commands and various third party tools. I use the Send SMTP Email command, SNDSMTPEMM, that comes within the IBM i operating system. Within the latest round of Technology Refreshes, IBM i 7.5 TR3 and 7.4 TR9, comes another way, with SQL.
A new scalar function was added to the SYSTOOLS library called SEND_EMAIL. It has four parameters:
- TO_EMAIL: Recipients email address. Mandatory
- SUBJECT: Email's subject line. Mandatory
- BODY: Email's body. Mandatory
- ATTACHMENT: IFS path name of the file to be sent as an attachment. Optional, if omitted no attachment is sent
For example: