< Back

Document Subject: Sending HTML to Outlook from Notes Client
Hint Short Cut: Add this to your code & documentation to help you find this page.
http://#HTMLtoOutlook or http://A555F9/nn.nsf/ByAlias/HTMLtoOutlook
Sending an HTML email from Notes to Outlook, this was a requirement at a large telco firm, that needed to send out reports.

The advantage of this is that you can have nicely presented emails and the graphics do not go with the email as they

can be loaded from the web as the email is loaded. You could in fact have an active email, that actually contains up to the minute information.

I have got this to work from Notes using the Outlook API to send to Outlook.

I have not tested it on a server. It could be used on a server potentially if the Server had an Outlook account and software set up.

Alternatively this could be done on a locally scheduled agent on a client machine.

Put this code into a button or agent that is run manually from action list:

  ' Code and comments are available from http://www.NotesNinjas.com
    Dim recip(0) As String    
  recip(0)=""
   Dim s As New notessession
   
  recip(0) = Inputbox$( "Enter your Outlook Email address:" , "Send To"  , "Adam Foster"  )
   If recip(0)="" Then
        Print "No name entered or cancel pressed."
        End
   End If
   
'     Set Outlook object
   Set appOutl = CreateObject("Outlook.Application")
   Set myNameSpace = appOutl.GetNameSpace("MAPI")
   Set myOlApp = CreateObject("Outlook.Application")
   Set myItem = myOlApp.CreateItem(0)  
   
  With myItem          
       .Subject = "HTML Test Email From Lotus Notes"          
       
        .HTMLBody = "<h1>Adam<b> <i>Foster</i></b><br></h1><br>" & _
        "This is an HTML email, the graphics are stored on the internet" &_

          " to minimise the size of the email.<br> " & _  
       "<centre> <a href=""
http://www.adfos.com"">AdFos</a> <br> " & _          
        "This code from <a href=""
http://www.NotesNinjas.com"">Notes Ninjas</a> .<br> " & _
        "This animated graphic link is 7k but this email is less than 1k<br>" & _
        "<a href='http://www.notestemplates.com'> " & _
        "<img border=0 src='http://www.adfos.com/A555F9/Ads.nsf/" & _
        "vAdByCustAndId/NotesTemplates-1/$File/AnimatedLogo1.gif'></a><br>" & _
        "<script> alert('Hello!  Javascript can also be written.'); </script><br> "
       
        Forall r In Recip
             Set myRequiredAttendee = myItem.Recipients.Add(r)
        End Forall
       
        If .Recipients.ResolveAll Then  
             .Save                                  
            .Send                                  
       Else
             Msgbox "At least one name was not resolved successfully in Outlook" & Chr(10) _
             & "Check that all names are valid and try again", 16, "Not resolved in Outlook"
       End If
   End With
   
  ' Close object references.
   Set appOutl = Nothing
   Set myItem = Nothing