Somebody wrote an utility with a cmd file and clp program.
I don't tried it, but maybe you can do.
See this <a href="http://www.itjungle.com/fhg/fhg052307-story01.html">page</a>
Try to call the code from your rpg4 program.
Last Wiki Answer Submitted: March 3, 2011 5:39 pm by Mariodlg2,790 pts.
If you live outside the United States, by submitting your email address you consent to having your personal data transferred to and processed in the United States.
Since all of the code is available with the article, you can simply run the same instructions in RPG as shown for CL.
But there are some technical elements that might need to be clear if deeper understanding is required.
First, spooled files can’t be e-mailed at all. Not in CL and not in RPG, nor any other language. What can be e-mailed is a copy of the text data that you can read from spooled files. Spooled files have internal structures that are intended for print writers.
You can use the CPYSPLF command to copy data from a spooled file into a physical file. Once in a physical file, you can handle the data any way you wish in RPG.
If you prefer not using a CL command at all, you can use Spooled File APIs in RPG to read the text data from the spooled file. Once you have formatted the e-mail the way you want it and appropriate for SMTP requirements, you can call the QtmmSendMail API to send it.
Part of the overall problem is that spooled files are essentially never sent from a Windows, Linux or other similar system. Pretty much no one would consider doing that, mostly because accessing them is too difficult and spooled files are not compatible with SMTP e-mail. Instead, they’d send the original document, or they’d create a new document in .PDF or other format and send that. Trying to send a Windows spooled file is far more complex than what you’re asking for. Yet, even the few steps mentioned here, or shown in the above article, can seem to be too much.
Nevertheless, QShell is “free” and the QtmmSendMail API is “free” if you have the system. Both can be accessed from RPG if that’s how you need to do it.
Others have done it and have made code or utilities available. For example, you might review iSeries MIME & Mail from Giovanni B. Perotti or RPGMail from Aaron Bartell. There are others as well. In each case, you download, install and configure, and then learn how to cal and use the procedures. I’m not sure any of them are seriously less difficult than using the system’s built-in functions, but a lot of people find them easy enough.
We used SNDEMAIL where i used to work. It worked great.
To find it search for an article by David Leland from “iSeriesNetwork” circa September? 1998? I’m reaching way back into my 256k ram. <g>
I had the command wrapped by a service program function for easy use from an rpg program.
We have ESEND at my current job so that’s the preferred method here.
(Wrapped also :–)
isn’t it a way to do it in rpg4 instead of clp?
and i mean in a free form
isn’t it a way to do it in rpg4 instead of clp?
Since all of the code is available with the article, you can simply run the same instructions in RPG as shown for CL.
But there are some technical elements that might need to be clear if deeper understanding is required.
First, spooled files can’t be e-mailed at all. Not in CL and not in RPG, nor any other language. What can be e-mailed is a copy of the text data that you can read from spooled files. Spooled files have internal structures that are intended for print writers.
You can use the CPYSPLF command to copy data from a spooled file into a physical file. Once in a physical file, you can handle the data any way you wish in RPG.
If you prefer not using a CL command at all, you can use Spooled File APIs in RPG to read the text data from the spooled file. Once you have formatted the e-mail the way you want it and appropriate for SMTP requirements, you can call the QtmmSendMail API to send it.
Or you could use the catsplf – Concatenate and print spool files QShell utility to copy the text into a streamfile. You’ll probably want to run the touch – Change file access and modification times QShell utility first to set an appropriate ASCII CCSID first. Then you can call the QtmmSendMail API.
Part of the overall problem is that spooled files are essentially never sent from a Windows, Linux or other similar system. Pretty much no one would consider doing that, mostly because accessing them is too difficult and spooled files are not compatible with SMTP e-mail. Instead, they’d send the original document, or they’d create a new document in .PDF or other format and send that. Trying to send a Windows spooled file is far more complex than what you’re asking for. Yet, even the few steps mentioned here, or shown in the above article, can seem to be too much.
Nevertheless, QShell is “free” and the QtmmSendMail API is “free” if you have the system. Both can be accessed from RPG if that’s how you need to do it.
Others have done it and have made code or utilities available. For example, you might review iSeries MIME & Mail from Giovanni B. Perotti or RPGMail from Aaron Bartell. There are others as well. In each case, you download, install and configure, and then learn how to cal and use the procedures. I’m not sure any of them are seriously less difficult than using the system’s built-in functions, but a lot of people find them easy enough.
Tom
We used SNDEMAIL where i used to work. It worked great.
To find it search for an article by David Leland from “iSeriesNetwork” circa September? 1998? I’m reaching way back into my 256k ram. <g>
I had the command wrapped by a service program function for easy use from an rpg program.
We have ESEND at my current job so that’s the preferred method here.
(Wrapped also :–)
John B