使用MIME发送邮件通知

Sub SendMailNotification( docMain As Notesdocument, strSendto As String ,strTempletNum As String)
 On Error Goto ErrorHandle
 
 Dim docMail   As NotesDocument
 Dim rti    As NotesRichTextItem
 Dim body    As NotesMIMEEntity
 Dim child   As NotesMIMEEntity
 Dim stream   As NotesStream
 Dim strTmp   As String
 Dim strReplace  As String
 Dim bSuccess  As Boolean
 Dim strHtml  As String
 s.ConvertMIME   = False
 Set stream   = s.CreateStream
 
 Set docMail  = New NotesDocument(docMain.ParentDatabase) 
 Call docMail.ReplaceItemValue("Form","Memo")
 Call docMail.ReplaceItemValue("Principal","Reporter Notification")
 Call docMail.ReplaceItemValue("ReplyTo","")
 Set body   = docMail.CreateMIMEEntity("Body")
 Set child  = body.CreateChildEntity
 
 
 Call stream.WriteText(MailText(docMain,strTempletNum))
 Call docMail.ReplaceItemValue( "Subject",MailSubject(docMain,strTempletNum))   
 
 strHtml = |<br><div style="font-size:15px; "><b><a href="|&ProfileDoc.DBHome(0) & ProfileDoc.DBPath(0) & |/0/| & docMain.UniversalID &|?opendocument"  target="_blank">请点击打开文档</a></b></div>|
 stream.WriteText(strHtml)
 
 Call docMail.ReplaceItemValue("BlindCopyTo", strSendto)
 Call child.SetContentFromText(stream, "text/html;charset=GB2312", ENC_NONE)
 Call stream.Truncate
 Call docMail.Send(False)
 s.ConvertMIME = True  
 Call docMail.Remove(True)
 
 Exit Sub
ErrorHandle:
 'iSuccess = False
 Messagebox db.FilePath & "_LSMailCommand.SendNotification:" & Error$ & " at line number " & Cstr(Erl) 
 Exit Sub
End Sub

posted on 2010-04-08 19:41 明高 阅读(160) 评论(0)  编辑  收藏


只有注册用户登录后才能发表评论。


网站导航:
 
<2010年4月>
28293031123
45678910
11121314151617
18192021222324
2526272829301
2345678

导航

统计

常用链接

留言簿

随笔分类

随笔档案

搜索

最新评论

阅读排行榜

评论排行榜