When delivering mail with internet mail protocols (see RFC2156, http://www.rfc-editor.org/rfc/rfc2156.txt), one should add a header that marks an email as auto-generated to prevent mail loops and out of office replies (the same thing as with doc.~$AutoForward = "1").
Original SendMail Code:
Function SendMail (md As MailData) As String
'** create and send an e-mail, based on information in the <br/>
'** MailData structure that was passed to us<br/>
On Error Goto mailError<br/>
<br/>
Dim session As New NotesSession<br/>
Dim db As NotesDatabase<br/>
Dim doc As NotesDocument<br/>
Dim body As NotesRichTextItem<br/>
<br/>
Set db = session.CurrentDatabase<br/>
Set doc = New NotesDocument(db)<br/>
Set body = New NotesRichTextItem(doc, "Body")<br/>
<br/>
'** basic mail message stuff<br/>
doc.Form = "Memo"<br/>
doc.SendTo = md.sendto<br/>
doc.CopyTo = md.cc<br/>
doc.BlindCopyTo = md.bcc<br/>
doc.Subject = md.subject<br/>
<br/>
'** change the apparent sender, if desired<br/>
If (Len(md.from) > 0) Then<br/>
doc.Principal = md.from<br/>
End If<br/>
<br/>
'** since we're sending this automatically, we don't want out of office messages<br/>
doc.~$AutoForward = "1"<br/>
<br/>
'** add priority, if desired<br/>
[…]
Suggested Revision:
Function SendMail (md As MailData) As String
'** create and send an e-mail, based on information in the <br/>
'** MailData structure that was passed to us<br/>
On Error Goto mailError<br/>
<br/>
Dim session As New NotesSession<br/>
Dim db As NotesDatabase<br/>
Dim doc As NotesDocument<br/>
Dim body As NotesRichTextItem<br/>
Dim mime As NotesMimeEntity <br/>
Dim header As NotesMimeHeader <br/>
<br/>
Set db = session.CurrentDatabase<br/>
Set doc = New NotesDocument(db)<br/>
Set body = New NotesRichTextItem(doc, "Body")<br/>
Set mime = doc.CreateMIMEEntity <br/>
<br/>
'** basic mail message stuff<br/>
doc.Form = "Memo"<br/>
doc.SendTo = md.sendto<br/>
doc.CopyTo = md.cc<br/>
doc.BlindCopyTo = md.bcc<br/>
doc.Subject = md.subject<br/>
<br/>
'** change the apparent sender, if desired<br/>
If (Len(md.from) > 0) Then<br/>
doc.Principal = md.from<br/>
End If<br/>
<br/>
'** since we're sending this automatically, we don't want out of office messages<br/>
doc.~$AutoForward = "1"<br/>
Set header = mime.CreateHeader("autosubmitted") <br/>
Call header.SetHeaderVal("auto-generated")<br/>
<br/>
'** add priority, if desired<br/>
[…]
—-
martin