1

I have a LotusScript script library that formats an HTML mail document that it works fine unless the SendTo name contains an accented character. -- Edit -- Sub Initialize Dim s As New NotesSession Dim mailName As String Dim body As NotesMIMEEntity

Dim header As NotesMIMEHeader
Dim stream As NotesStream
Dim thisDB As NotesDatabase
Dim MailDoc As NotesDocument
Set thisDB = s.currentDatabase
Set mailDoc = thisDB.Createdocument()
mailName = "BØRG@WFSSystems.ca"
Set stream = s.CreateStream
s.ConvertMIME = False ' Do not convert MIME to rich text 
Set body = mailDoc.CreateMIMEEntity

Set header = body.CreateHeader("To")
Call header.SetHeaderValAndParams("charset=UTF-16")
Call header.SetHeaderVal("MIME multipart message")
Call header.SetHeaderVal(mailName)

Call stream.writetext(|</body>|)
Call stream.writetext(|</html>|) 
'Convert stream then send
Call body.SetContentFromText(stream, "text/HTML;charset=UTF-16", ENC_IDENTITY_7BIT)
Call mailDoc.Send(False)
s.ConvertMIME = True ' Restore conversion - very important 

End Sub

Above is the whole sub that I set as a test. It looks like the accented character is maintained through the whole process and the email is actually sent. I'm working with a local copy of my mail file so I can see what ends up in mail.box. The Mail.box shows the recipient to be "BRG@WFSSystems.ca". So now I'm wondering if the issue is my code or is it my settings or preferences somewhere?

Bill F
  • 2,057
  • 3
  • 18
  • 39
  • I'm quite confused as to why you're setting To and Subject headers within the Body MIME part instead of directly on mailDoc, but I'll ignore that for now. In any case, I believe the charset for LotusScript is UTF-16, not UTF-8. (That's from dim memory; I could be wrong.) That doesn't affect the data that you're reading from stream, but it would affect the data that you are reading from MailNames, which I presume is a standard LotusScript string variable that you've probably read from a Notes document. You may want to try SetHeaderValAndParams, and specify "charset=UTF-16: for the header. – Richard Schwartz Apr 08 '16 at 18:13

0 Answers0