Hi,Please I need help with my agent to send a document as HTML email to external persons.
My document has e rich text filed to save attachments that can be from any type, pdf, xls, doc… etc.
This field that stores the attachments is called rtf_Attach.
I need to include this field and its contents in the html mail that the user sending externally.
Is that possible?
I searched a lot but I couldn’t find a solution…
Sub Initialize
On Error GoTo errHandler
Dim se As New NotesSession
Dim doc As NotesDocument
Dim maildoc As NotesDocument
Dim db As NotesDatabase
Dim body As NotesMIMEEntity
Dim header As NotesMIMEHeader
Dim stream As NotesStream
Dim col As NotesDocumentCollection
Set db = se.CurrentDatabase
Dim workspace As New NotesUIWorkspace
Set col = db.unprocesseddocuments
Set doc = col.getfirstdocument()
se.ConvertMIME = False
Set db=se.CurrentDatabase
Set maildoc = db.CreateDocument
maildoc.Form = "Memo"
maildoc.Subject = doc.company(0)
Set body = maildoc.CreateMIMEEntity
Set header = body.CreateHeader("To")
Call header.SetHeaderVal(doc.externalEmail(0))
Call stream.WriteText ({})
Call stream.WriteText ({<body text="#666666"
bgcolor=“#FFFFFF”
leftmargin=“0”
topmargin=“0” marginheight=“0”
marginwidth=“0”>})
' BEGIN: HTML body
Call stream.WriteText ({
<table width="100%" border="0"
cellspacing=“0” cellpadding=“0”
bgcolor=“#FFFFFF”>
<tr>
Title})
Call stream.Writetext({<b><font color = "red">})
Call stream.WriteText(doc.GetItemValue("Prio")(0))
Call stream.Writetext({
<br>
<b>Till</b>
<br>
})
Call stream.Writetext({<b>})
’ END: HTML body
' Close the HTML
Call stream.WriteText({</body></html>})
Call body.SetContentFromText (stream, “text/html;charset=iso-8859-1”,ENC_NONE)
Call maildoc.MakeResponse( doc )
maildoc.createdDate = Now()
maildoc.createdBy = nam.Abbreviated
maildoc.tmpHideSentBy = "1"
Call maildoc.save(True,True)
Call doc.ReplaceItemValue( "draft", "" )
Call doc.Save( True, True )
Set doc = col.getnextdocument(doc)
Call maildoc.Send(False)
se.ConvertMIME = True
Call stream.Close
MsgBox "Document is sent"
Exit Sub
errHandler:
MessageBox "Error code=" & Err() & "; Info=" & Error() & "; Line=" & Erl()
End Sub
Please help by completing my code! I appreciate it.