Hi All,
I have this existing code where I append a html link with dynamic variables at the bottom. Recently I observed one problem with this code. When a user receives a email from outside party with attachment and user he replies that email with another attachment, the outside party receives only the old attachment and not the new one. I was doing research on this problem. When user deletes the old attachment and then attaches new one then original sender recieves it fine. This is causing lot of problem as missing attachment is no good. If I don’t convert this email to MIME, everything is fine. But I will have to convert it to MIME so as HTML link to work.
I will appreciate if anyone can give any type of suggestions/guidelines to resolve this problem.
See my code below →
Sub Click(Source As Button)
Dim session As New NotesSession
Dim workspace As New NotesUIWorkspace
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim uidoc As NotesUIDocument
Dim child As NotesMIMEEntity
Dim header As NotesMIMEHeader
Dim mime As NotesMIMEEntity
Dim parent As NotesMIMEEntity
Dim stream As NotesStream
Dim nam As NotesName
Dim nam1 As NotesName
Dim item As NotesItem
Dim mformula As String
InternetMail=False
session.ConvertMIME = False ' Do not convert MIME to rich text
'Instantiate variables
Set db = session.CurrentDatabase
Set uidoc = workspace.CurrentDocument
Call uidoc.FieldSetText ( "SendTo", uidoc.FieldGetText("EnterSendTo"))
Call uidoc.FieldSetText ( "CopyTo", uidoc.FieldGetText("EnterCopyTo"))
Call uidoc.Save
Set doc = uidoc.Document
Set mime = doc.GetMIMEEntity
If mime.ContentType <> "multipart" Then
Set parent = mime.CreateParentEntity
Else
Set parent = mime
End If
Set header = mime.getNthHeader("Content-Type")
Call header.SetHeaderVal("multipart/mixed")
Set nam = New NotesName(doc.GetItemValue("EnterSendTo")(0))
DisplaySendTo = doc.GetItemValue("EnterSendTo")(0)
If Instr(DisplaySendTo,".") >0 And Instr(DisplaySendTo,"@") Then
DisplaySendTo = nam.Addr821
Else
DisplaySendTo = nam.Abbreviated
mformula = |@NameLookup([NoUpdate];"| + DisplaySendTo + |";"InternetAddress")|
tmp = Evaluate(mformula, doc)
DisplaySendTo = tmp(0)
End If
Set nam1 = New NotesName(doc.GetItemValue("AltFrom")(0))
'DisplayFrom =nam1.Common
DisplayFrom = nam1.Abbreviated
mformula1 = |@NameLookup([NoUpdate];"| + DisplayFrom + |";"InternetAddress")|
tmp1 = Evaluate(mformula1, doc)
DisplayFrom = tmp1(0)
REM Create child entity
Set child = parent.CreateChildEntity
'Add the HTML for the e-mail into the data stream.
Call stream.WriteText({<br><font face=Verdana color=#000099 size=2> Please give me feedback on my service <b><a href=3D"http://www.xxx.com/ revised1.asp?}+DisplaySendTo+ "&" +DisplayFrom+{"> Click here</a></b></font>} & Chr(10) & Chr(10), EOL_CRLF)
Call child.SetContentFromText(stream, "text/html", ENC_QUOTED_PRINTABLE)
Call stream.Truncate
Call doc.Save(True, False)
Call doc.Send( False)
Call uidoc.Save
Call uidoc.Close(True)
session.ConvertMIME = True ' Restore conversion
End Sub