Dim s As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Set doc = s.DocumentContext
Set db = s.CurrentDatabase 'Set variables
Subj = doc.GetItemValue( "Subject" )
Frm = doc.GetItemValue( "From" )
'Only reply to the message if it from ABC e-mail addresses and the subject does not contain "Auto Notification"
If Instr(1, Subj(0), "(Auto Notification)") = 0 And Instr(1, Frm(0), "@ABC.com") = 0 Then
Set maildoc = New NotesDocument (db)
maildoc.Form = "Memo"
maildoc.SendTo = Frm(0)
maildoc.Principal = "Auto Notification"
maildoc.ReplyTo = "[email protected]"
maildoc.Subject = "RE:" & Trim$(Subj(0)) & " (Auto Notification)"
Set rtitem = doc.GetFirstItem( "Body" )
' Produce contents of reply
Set rti = New NotesRichTextItem (maildoc, "Body")
Call rti.AppendText ("THIS IS AN AUTOMATED E-MAIL -- PLEASE DO NOT REPLY TO THIS E-MAIL")
Call rti.AddNewLine( 2 )
Call rti.AppendText ("----------------------------------------------------------
Call rti.AddNewLine( 2 )
Call rti.AppendText(rtitem.Text)
Call maildoc.Send(False)
End If
|