右键我试图通过Lotus Notes发送电子邮件格式的excel电子表格,它具有附件,并且身体需要使用HTML。使用Excel从Lotus Notes发送电子邮件并使用附件和HTML主体
我有一些代码,从我读过的所有应该允许我这样做,但它没有。 没有HTML主体附件会发送,当我impliment一个HTML主体的电子邮件仍然发送但附件消失,我试着重新排列代码的顺序,删除可能不需要的位,但都是入侵的顺序。
(你需要参考的Lotus Domino对象来运行该代码。 strEmail是电子邮件地址 strAttach是附件 strSubject的字符串位置是主题文本 strBody是正文 )
Sub Send_Lotus_Email(strEmail, strAttach, strSubject, strBody)
Dim noSession As Object, noDatabase As Object, noDocument As Object
Dim obAttachment As Object, EmbedObject As Object
Const EMBED_ATTACHMENT As Long = 1454
Set noSession = CreateObject("Notes.NotesSession")
Set noDatabase = noSession.GETDATABASE("", "")
'If Lotus Notes is not open then open the mail-part of it.
If noDatabase.IsOpen = False Then noDatabase.OPENMAIL
'Create the e-mail and the attachment.
Set noDocument = noDatabase.CreateDocument
Set obAttachment = noDocument.CreateRichTextItem("strAttach")
Set EmbedObject = obAttachment.EmbedObject(EMBED_ATTACHMENT, "", strAttach)
'Add values to the created e-mail main properties.
With noDocument
.Form = "Memo"
.SendTo = strEmail
'.Body = strBody ' Where to send the body if HTML body isn't used.
.Subject = strSubject
.SaveMessageOnSend = True
End With
noSession.ConvertMIME = False
Set Body = noDocument.CreateMIMEEntity("Body") ' MIMEEntity to support HTML
Set stream = noSession.CreateStream
Call stream.WriteText(strBody) ' Write the body text to the stream
Call Body.SetContentFromText(stream, "text/html;charset=iso-8859-1", ENC_IDENTITY_8BIT)
noSession.ConvertMIME = True
'Send the e-mail.
With noDocument
.PostedDate = Now()
.Send 0, strEmail
End With
'Release objects from the memory.
Set EmbedObject = Nothing
Set obAttachment = Nothing
Set noDocument = Nothing
Set noDatabase = Nothing
Set noSession = Nothing
End Sub
如果somone可以指向我正确的方向,我将不胜感激。
编辑: 我已经做了更多的调查,我发现一个奇怪的现象,如果我看发送的文件夹中的电子邮件都有回形针的图标有附件,即使您甚至进入电子邮件甚至在发送HTML的时候不显示附件。
2010-03-23
Anthony