This post is one part of the Watchdog Series.
Mail Content

Sending mails as an status or error report is essential because you don’t want to manually check all the folders and images for an error every day. Whenever a higher pixel difference (than our threshold) appears, a mail is sent out to a responsible person. This mail looks like below and contains:

  • name of the material
  • the newest image
  • the older image
  • a difference image (shows differences via blue pixels, created via compare process)
  • a link to the difference via browser (see the chapter about the Watchdog Gallery)
  • the direct link/path to the image files
Of course mails don’t look like letters from the middle age but for this article I found it more appealing to “pimp” them a bit. :)

Command Line Mail

The program we’re using for sending these mails is called Blat and can be accessed via command line which makes it easy to use it via BAT/C# to send mails. There are different ways to send a mail but I preferred to first write the whole Mail-HTML-Code into a TXT file and then hand it over to the mail program:

blat.exe mailcontent.txt -server -f -u username -pw god -to -subject “Hello World” -html

Embed pictures

If you want to embed the pictures like we did, you have to already refer their file-names (without path) in the HTML code of your mail …

<img src=”cid:test1.png“>

… and then use the -embed parameter to embed them:

blat.exe mailcontent.txt -server -f -u username -pw god -to -subject “Hello World” -html -embed “d:\test1.png” -embed “d:\test2.png” -embed “d:\diff.png”

Mail Subject

I would suggest to put the pixel difference directly into the mail-subject to be able to see how drastic the change is even without opening the mail (but just looking at the list in your inbox):

Conclusion Mail

When the program finished it sends a final conclusion mail. Two good reasons to do this:

  1. There are two reasons for not getting error reports: 1. There are no errors 2. the whole script broke. If there’s no final report, you never can be sure that the system still works if no error happened (which is hopefully the case most of the time)
  2. You can add some nice global statistics into your report to impress people:

Let’s now talk about how to keep overview about all this data.

Continue with the next part: Create Gallery.

Leave a Reply

Your email address will not be published. Required fields are marked *