Notice "Call stream.WriteText()", which allows us to add our HTML formatting. You'll still have to follow the normal rules of SMTP. For instance, including CSS in your email will require to call your stylesheet.
Set docMail = db.CreateDocument
'// COMPOSE MESSAGE
session.ConvertMIME = False ' Do not convert MIME to rich text
docMail.Form = "Memo"
docMail.Subject = docNotify.emailSubject(0)
docMail.Principal = "Automated Notification"
'// CREATE MAIN MIME MESSAGE
Set stream = session.CreateStream
Set MIMERoot = docMail.CreateMIMEEntity ' message root
'// CREATE CHILD ENTITIES
Set mime = MIMERoot.CreateChildEntity
Set header = MIMERoot.getNthHeader("Content-Type")
Call header.SetHeaderVal("multipart/related")
'// HEADER
Call stream.WriteText(| | Text | & document.field(0) & | |
Text: |) Call stream.WriteText(| Database: | & db.Title & | |) Call stream.WriteText(| View: | & document.field(0) & | |
Optional Coding Parameters you may need:
'// OPTIONAL - Create inline image reference
' Set mime = MIMERoot.CreateChildEntity
' Call stream.Open("http://www.myserver.com/applications/mmail.nsf/" & imagename & "?OpenImageResource")
' Call mime.SetContentFromBytes(stream, "image/jpeg", ENC_NONE)
' Call stream.Close
' Call mime.EncodeContent(ENC_BASE64)
Download the code
There is actually a good book out there for learning more about Lotus Notes. It's one of the few:
No comments:
Post a Comment