I have created LS Agent works to send HTML Newsletters out to our customers from my school. The department heads would like to have a salutation field added before the html newsletter. The below agent will send HTML mail perfectly but I try to add FirstName field in the form so I can have the mail more personalized to recipients. something like
Dear + Doc.Firstname.
Would you please take a look of the codes and see how can I add the class for doc.Firstname into it so I can call for it from the scripts. I’m lost from this part. You can see that my LS is very weak- I have no set up for errors or doc count. but the main thing it works. You are welcome to point out more weakness from the scripts if you see them.
Thank you so very much for your time.
=========================================
Option Public
Sub Initialize
Dim s As New NotesSession
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim maildoc As NotesDocument
Dim doc As NotesDocument
Dim mime As NotesMimeEntity
Dim mhdr As NotesMimeHeader
Dim recipient As String
Set db = s.currentdatabase
Set dc = db.UnprocessedDocuments
Set doc = dc.getFirstDocument()
Set maildoc = db.createdocument
s.convertmime = False
On Error Goto cleanup
'SET STATUS FIELD TO “SENT”
While Not(doc Is Nothing)
doc.Status = "Sent"
'MAKE THE MHTML MESSAGE & MAIL IT
Call MakeRemoteSlideShow( s, maildoc, recipient)
maildoc.Form = "Memo"
Forall x In doc.recipient
Call maildoc.Send(False, x)
End Forall
Call doc.Save( False, True )
Set doc = dc.getNextDocument( doc )
Wend
cleanup:
s.ConvertMime = True
End Sub
=======
Sub MakeRemoteSlideShow( s As NotesSession, docR As NotesDocument, recipient As String)
Dim mimeC As notesmimeentity
Dim mimeR As notesmimeentity
Dim mhdrR As notesmimeheader
Dim ns As notesstream
Set ns = s.createstream
Set d = s.currentdatabase
Set docR = d.createdocument
'ADD SUBJECT HEADER
Set mimeR = docR.createmimeentity
Set mhdrR = mimeR.createheader("Subject")
Call mhdrR.setheaderval("PCRINST Sample Test Mail")
'INSERT NEWSLETTER HTML FILE
Set mimeC = mimeR.createchildentity
Set mhdrR = mimeR.getNthHeader("Content-Type")
Call mhdrR.setheaderval("multipart/alternative")
Call ns.Open ("C:\Documents and Settings\Owner\My Documents\prinst.html")
Call mimeC.setcontentfromtext( ns, "text/html", ENC_NONE )
Call ns.close
End Sub
=====================
TIA
Myle