java lotus 表格_使用Excel从Lotus Notes发送电子邮件并具有附件和HTML正文

我正在尝试通过Lotus笔记发送电子邮件表格excel电子表格,它有一个附件,并且正文需要是HTML格式 .

我有一些代码,我已经读过的所有内容应该允许我这样做,但事实并非如此 . 如果没有附件将发送的HTML正文,当我发送电子邮件仍然发送的HTML正文但附件消失时,我已经尝试重新排列代码的顺序,删除可能不需要的所有内容,但所有内容都可以保留 .

(您需要引用Lotus Domino Objects来运行此代码.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

结束子

如果somone可以指出我正确的方向,我将不胜感激 .

编辑:我已经做了一些调查,我发现一个奇怪的是,如果我看一下发送的文件夹,电子邮件都有附件的回形针图标,即使你进入电子邮件甚至在发送的HTML中那些没有显示附件 .

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值