27 September 2010

Notes 8 HTML Email Image Loading

Well, my dev team has finally been instructed that we're moving to Notes 8, and not a moment too soon! 

I know Notes 8 has been out for several years now, but when you're maintaining the sheer amount of installations that my team deals with, I have a feeling it isn't too out of the ordinary to wait a year or so before moving to a new version of a major environment.

I've been doing a little bit of dev here and there, and I reached my first roadblock today -- HTML emails with images just won't load up in Notes 8 or 8.5.  (They load up normally in Notes 7.)  Either the user has to right-click on the email and select "Load Images," or the individual user has to set an option in his/her preference.


It looks a little different in Notes 8.5.
Now, of course, you can set this preference amongst many computers by using a Windows Policy, but the setting is disabled by default (viruses, spam, saving bandwidth -- take your pick).  So, that idea was shot down, and I didn't really argue that much -- I've dealt with these kinds of problems in Notes before, and I had the nagging suspicion that there's a hidden field or two you can set on a new email that will enable those images to load when the user opens the email.

And what do you know, there is: 
Looking through the design of the new mail template, I found that the "Show Images" link is on the (FollowUpMemoSubform) subform. The code indicates that a field named $DelayedImagesOK set to the value "ok" would display the inline images. In the mail template, this field is set using the ShowDelayedImages sub, in the DelayedImages script library. What the code does is to create the field $DelayedImagesOK, setting the value to "ok" and saving the document. The client then reloads the document, which displays the images. [Source]
I actually found this through a post at the Lotus Developer Forums -- the dev wasn't having very good luck with it (he seemed to be concerned with what type of field the "$DelayedImagesOK" field needed to be).  However, from what I've found, it doesn't matter -- or at least it doesn't in the way that I'm creating these emails.

I create them in LS and Java agents, and it seems like just using

Call doc.ReplaceItemValue("$DelayedImagesOK", "ok")

in LotusScript or

memo.appendItemValue("$DelayedImagesOK","ok");

in Java works just fine.  Try it out!

2 comments:

  1. Have a look at my "Show Images Whitelist" code

    http://idocode.net/idocode/blog.nsf/dx/26-11-
    2008091419FLKBP2.htm

    ReplyDelete
  2. Not bad -- may get something like that working for the users. All of the mail I deal with is internal, luckily.

    ReplyDelete