We had some… problems with our utility bill emails. They weren’t worded clearly enough that some people were getting confused. See, when I wrote this, used the only approach I knew and manually assembled a string of text until the email was created (depended upon if they were auto-pay or not), but over all the emails were very similar. We like to be customer friendly, so we decided we better make the emails clearer.
After working with our communications department, they came up with a very good set of emails… that don’t work well with how I am currently assembling the emails. Damn!
So, I walked back to my desk feeling like “Oh crap! I have a lot of changes to do.” Then I had the thought that too bad I can’t template… oh yes I can! CGIDEV2 does that! Since I haven’t done much in that field, I figured I would hit up the midrange.com WEB400 community to see what else there is out there. I came back with a list of a few frameworks, but most people basically said that CGIDEV2 was the best place to start. One helpful person, gave me the following list:
I decided to use CGIDEV2 as that was the most promoted package. After I had it installed, tried to figure out what I needed in order to do what I want. Here is the minimal information that is needed:
First you need to add the following two copybooks to your D-specs:
Then in my loop I did the following:
dow (not %eof());
// Clear the buffer to make sure it is empty.
// Pull the correct message.
// Update the variables in the message
callp updHTMLvar(‘custnum’:%editw(CustN:’0 – ‘));
// “Write” the file into the buffer
// Save the file to the IFS in the tmp directory.
rc = WrtHtmlToStmf(‘/tmp/emailbody.txt’);
// Send email through MailTool (http://bvstools.com)
Suprisingly this worked the first time! Now if the communications department ever wants to change the email, all I need to do is update the text and the email is now changed.
I hope this helps others that are looking at doing this.