TIP - Formatted HTML output to your e-mail - VisualCron - Forum

Community forum

Gary_W
2020-02-25T22:51:25Z
I finally got to the bottom of getting nicely formatted output sent to my e-mail and thought I'd share it. The disclaimer is this works for my environment here, no promises it will work for yours. I'll bet some of you even have a better way for doing this. If so, please post below. Anyway, I have an Oracle stored procedure in our utility package that collects some database stats that I need to monitor daily. The procedure uses an OUT parameter to pass a refcursor back that points to the formatted output. I can run it manually from Toad and the output is in a proportional font and looks nice, all lined up, etc.

I created a VC job to run this procedure and the STDOUT (found when double-clicking the output of the task in VC) shows the output in a proportional font as well, text all lined up, etc. However, when I send the STDOUT to my Outlook e-mail as text using {TASK(PrevTask|StdOut)}, it displays by default in a non-proportional font and thus is difficult to read. To get it to send in a proportional font, I send it as HTML from VC with the following as the body of the HTML text. In my environment, it is received by Outlook as an HTML e-mail in Courier New with the same formatting as I coded for in the stored procedure.

I understand that whether or not this works may be dependent on your e-mail client settings, etc, but I hope this helps someone out there trying to do the same thing. Let me know if it helped you.

<!--
The <tt> tag means use a proportional font.
The <pre> tag means the text is pre-formatted so don't touch multiple spaces,
line breaks, etc. It should match what the previous task output looks like
in VisualCron without having to specify HTML tags beyond what you see here
unless you need something fancy.

Outlook Should receive this as an HTML e-mail formatted with Courier New font.
-->

<html>
<body>
<tt><pre>{TASK(PrevTask|StdOut)}</pre></tt>
</body>
</html>
thomas
2020-02-26T08:41:22Z
Making data look nice in Outlook is tricky as it only understands a subset og html and css. And in some cases it interprets them different from the standards. I have a C# assembly I call to format things nicely. I am planning to make somthing in the task repository and upload it. Just need som spare time..
wiseguy001
2020-03-24T18:08:01Z
Heavily relying on standardized variable names within my jobs, I use a notification to send email for job failures.
I use a combination of standard VC variables and Job variables to populate the basic email settings and recipients distribution with the text shown below in the HTML tab to result in a "pretty" table showing job, task, and failure message:

<table cellspacing=3 cellpadding=3 border=6>
<tbody>
<tr>
<td colspan=2 align=center>Error processing <b>{JOB(Active|Name)}</b></td>
</tr>
<tr>
<td>Failed Step:</td>
<td>{TASK(PrevTask|Name)}</td>
</tr>
<tr>
<td>Error Message:</td>
<td><b><font color="red">{TASK(PrevTask|StdErr)}</b></font></td>
</tr>
</tbody>
</table>
Scroll to Top