Evernote, Remember The Milk, SMTP / MIME and z/OS Batch
MartinPacker 11000094DH Comments (3) Visits (9464)
Another kernel popped the other day: SMTP / MIME.
But what on earth is MiGueL Mainframe troubling himself with SMTP / MIME for? Let's come at this from a different angle...
You probably know by now that when you send me your data it gets put through some batch reporting: Ultimately I don't create the graphs by hand, but I do do the analysis and put the presentation together myself. That's the "high value" creative part.
You probably also know that the JCL to build performance databases and do the reporting is generated using ISPF File Tailoring and some panels.
But what about the actual workflow? In broad terms it's pretty much all the same - for each engagement: I'd like my "to do" list for a project to be automatically generated. And I might well want some other notes to be automatically generated - perhaps a slide template or a "lessons learned" boilerplate note or something.
For most of my life I keep notes in a very fine service: Evernote. I also keep my "to do" list in Remember The Milk. I'm sure other fine services exist but these are the ones I use - and the ones I know the following technique work for.
I'd like to automate my workflow, as I said, and some of my engagement-related documentation.1.
Both Evernote and Remember The Milk supply an email address specific to an account: If you knew my Evernote email address, for instance, you could email in a note and Evernote would store it for us.2 So I can teach any email client how to add notes to Evernote and "to do" items to Remember The Milk. The latter accepts a list of items, along with due dates, priorities etc.
Between them I'm sure I can automate quite a lot of workflow, while continuing to make careful choices to keep client information secure.
Email and z/OS / TSO Batch
So why not have my JCL generator include some steps to generate this material?
Though that was a rhetorical question it does have an answer. You have to make it so - with a SMOP.
But actually it's not difficult.
In "Standing On The Shoulders Of Giants"3 Mode, I notice we already have a jobstep - very early in our process flow - that uses XMIT to send a small tracking file, containing a File-Tailored set of information about the study. It's a flat file but it points the way. It doesn't use SMTP and it doesn't include HTML.
I found out the appropriate SMTP address that my z/OS system has access to. With it I can send emails to anywhere - inside IBM and beyond (as Evernote and RTM both are).
Putting It Together
I've already created a batch job that can send HTML-formatted emails. It looks like this:
//XMITSMTP EXEC PGM=
In the above I chose to use MSGDSNAME rather than DSNAME to point to the data. This stands a better chance of having the EBCDIC translation work right. It points to the actual MIME message:
Helo MVSHOS mail from
This is in what is called "multipart MIME format" - and you can tell this from the "Content-type: multipart/mixed;" line. (Each part is separated by the line "simple boundary".) The HTML is obvious and the fact it is to be treated as HTML is indicated by the "Content-type: text/html" line.
One of the things this illustrates is that sending HTML by email isn't complicated at all.
Note:The actual "to address" in the "rcpt" line needed a relay address in my case - preceded by an "@" and separated from the eventual address by a ":". You might need one too.
When I sent this HTML to Evernote it worked fine and I have a nicely formatted note, complete with the title preserved. If you want to understand how Evernote handles emails look here. For Remember The Milk look here.
The note in Evernote looked very much like this:
This is Arial font in blue.
As I said earlier, sending an HTML-formatted email is not significantly more difficult than sending a plain text one. I hope this blog post demonstrates that: Examine the code you're using today to send emails from z/OS and I think you'll agree. And I think you'll find cases where it would be a better solution.
On a final note, IBM (and others) have email solutions. And indeed workflow solutions. Those have their own applicability - for the more complex or larger-scale applications.
But if you want "lightweight", "simple", "informal" workflow my approach might make sense to you. As it is I'm going to build this, small pieces at a time - like I do most of my development work.
1 I'm very clear about not compromising customer data or situations. Customer confidentiality is key - and along with other cloud services - I can't store sensitive or identifiable data in Evernote or Remember The Milk.4. Similarly, I'm incredibly circumspect in reviewing customer-related stuff in public places.
2 Obviously this is open to abuse - as anyone with the email address can fill your account up with SPAM. But you can change the email address at any time - and I don't give it out often.
3 When I first heard this cliché I thought it was Albert Einstein. And later on I thought (slightly more accurately) it was Isaac Newton. Obviously giving Maths/Physics giants more credit than they're due. I wonder why.
4 As one of the authors of this piece of the IBM Social Computing Guidelines I'd urge you to read this short document to understand IBM's stance.