Send a Spool File from AS/400 with a Specific Subject Line and Message Body
May 23, 2007 Hey, Ted
Note: The code accompanying this article is available for download here. A while back, I was working on a project that required an e-mail to be sent with a resulting spool file as an attachment and with a specific subject line and specific message body. I had no trouble figuring out how to send the spool file as a document and how to create the message body. The hard part was customizing the subject line of the e-mail. This was important because the subject line would have provided the users a hint about the urgency of the task they need to perform. Any time the command SNDDST is used to send an e-mail with the TYPE parameter specified as *DOC, the name of the document pre-fills the subject line of the e-mail by default. I spent hours to find out how to get around it. I wrote the Send Email Spool File (SNDESPF) command to send an spool file of any length as an e-mail attachment. Source code for the command and its command-processing program, ASNDESPF, are available for download. There are two things to consider before using the utility.
To prevent users from sending e-mail to outside addresses, I hard coded the domain name. You can change that if you wish. The e-mail address parameter of the command does not require the domain name. If the domain name of your company is more than 15 bytes, adjust the size of the parameter &INTADD. Also it needs to be mentioned that if no spool number is provided in the command, the last spool file of the job (this is useful in batch processing) will be sent. –Manouchehr Babakhani Thanks to Manouchehr for sharing his utility with us. I have no doubt he’s having great success with it in his shop. I know that e-mailing from the System i can be a challenge at times, so I was glad to pass his code along to the readers. –Ted
|