Sub Initialize
Dim ss As New NotesSession
Dim db As NotesDatabase
Set db = ss.CurrentDatabase
Dim view As NotesView
Set view = db.GetView("(v_NotEndOf2Months)")
view.AutoUpdate=False
Dim doc As NotesDocument
Dim maildoc As NotesDocument
Set maildoc = New NotesDocument(db)
maildoc.form="memo"
12 Dim item As notesitem
13 Set item = New NotesItem( maildoc, "SendTo","")
maildoc.subject="mail subject!" '设置邮件主题
15 Call item.AppendToTextList("Wendy Xia") '设置收件人
maildoc.sendto=Arrayunique(maildoc.sendto) '去掉重複人員
'''' maildoc.sendto= doc.receiver '也可以直接给sentto域赋值,可以是一个单值域也可以是一个多值域,这样就不用写上面第12,13,15行的信息了
''''''''''''''''''''''
Set doc = view.GetFirstDocument
Dim body As NotesMIMEEntity
Dim stream As NotesStream
ss.ConvertMIME = False ' Do not convert MIME to rich text
Set stream = ss.CreateStream
Set body = maildoc.CreateMIMEEntity
' Open the HTML (Title doesn't matter since it doesn't appear anywhere)
Call stream.WriteText ({<html><head><title></title>})
' BEGIN: Inline Stylesheet
Call stream.WriteText (|
<style type="text/css">
<!--
.text, td, tr, p, br, body {
COLOR: #666666;
FONT-FAMILY: Arial, Helvetica, sans-serif;
FONT-SIZE: 12px;
}
a {
font-family: Arial, Helvetica, sans-serif;
color: #663399;
FONT-WEIGHT: bold;
text-decoration: none;
}
-->
</style>
|)
' END: Inline Stylesheet
Call stream.WriteText ({</head>})
Call stream.WriteText ({<body text="#666666" bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0">})
' BEGIN: HTML body
Call stream.WriteText ({
<p>Dear All:</p>
<p> 請點擊相應項目的連接進行處理:</p>
<p> </p>})
Call stream.WriteText ({<TABLE width="95%" align=center border="0" cellspacing="0" cellpadding="1" bordercolor="#ffffff" bordercolorlight="#276db2" bordercolordark="#FFFFFF" class=td03>})
Call stream.WriteText ({ <tr bgcolor="#b3cbff">
<td>主 題</td>
<td>申請時間</td>
</tr>})
While Not doc Is Nothing
Call stream.WriteText ({ <tr>
<td><a href=http://}+doc.Server_Name(0)+{/}+doc.DBPath(0)+{/0/}+doc.mainUNID(0)+{?EditDocument&Login target=_blank>}+Cstr(doc.SUBJECT(0))+{</a></td>
<td>}+doc.ap_date(0)+{</td>
</tr>})
Set doc = view.GetNextDocument(doc)
Wend
Call stream.WriteText ({</table>})
' END: HTML body
' Close the HTML
Call stream.WriteText ({</body></html>})
' Ensure the MIME content will be recognized as HTML (Must be after the stream is written)
Call body.SetContentFromText (stream, "text/html;charset=gb2312", ENC_NONE)
'Send the email
Call maildoc.Send(False)
ss.ConvertMIME = True ' Restore conversion
End Sub
如果觉得我的文章对您有用,请点赞。您的支持将鼓励我继续创作!
赞0
添加新评论0 条评论