我已经编写了 VBA 代码来从组邮箱发送电子邮件。我设置了主要字段来说明邮件来自哪里。它几乎可以正常工作,将消息放入组邮箱的已发送项目中。即使我在 Principal 字段中有组邮箱名称,它仍然说它是发送给我的。我发现无论哪个用户查看已发送项目中的消息,它都说它是由该用户发送的(它是一个动态字段)。我想设置 From 字段,我发现我可以使用 '.from = "(User Name)"' 之类的东西来做到这一点。
所以我知道可用的基本变量,例如 .SendTo、.CopyTo、.Principal、.From。但是我已经进行了网络搜索,但我无法弄清楚如何获得所有可用变量的完整列表。希望有人可以向我指出一些列出这些的文档?
以下是我的代码供参考:
Function EmailFromNotes(strSendTo As String, strCopy As String, strSubject As String, _
strText1 As String, strText2 As String, strText3 As String, _
strText4 As String, strText5 As String, strAttachment As String, strFrom as String)
Dim notesdb As Object
Dim notesdoc As Object
Dim notesrtf As Object
Dim notessession As Object
Dim i As Integer
Dim AttachME As Object 'The attachment richtextfile object
Dim EmbedObj As Object 'The embedded object (Attachment)
Set notessession = CreateObject("Notes.Notessession")
''''''''Group Mailbox'''''''''''''''''''''''''''''''''''''''''''''''''
Set notesdb = notessession.GetDatabase("Servername", "mailin\GroupMailbox.nsf")
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Open the mail database in notes
If notesdb.IsOpen = True Then
'Already open for mail
Else
notesdb.OPENMAIL
End If
Set notesdoc = notesdb.CreateDocument
Call notesdoc.ReplaceItemValue("Subject", strSubject)
Set notesrtf = notesdoc.CreateRichTextItem("body")
Call notesrtf.AppendText(strText1 & vbCrLf & strText2 & vbCrLf & strText3 & vbCrLf & strText4 & vbCrLf & strText5)
'''strCopy = "michael.thain@pnc.com"
notesdoc.SendTo = strSendTo
notesdoc.CopyTo = strCopy
notesdoc.from = strFrom
''''''''Group Mailbox'''''''''''''''''''''''''''''''''''''''''''''''''
notesdoc.principal = "Group Mailbox Name"
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
If strAttachment = "" Then
Else
Set AttachME = notesdoc.CreateRichTextItem(strAttachment)
Set EmbedObj = AttachME.EmbedObject(1454, "", strAttachment)
End If
Call notesdoc.Save(True, False)
notesdoc.SaveMessageOnSend = True
Call notesdoc.Send(False, strSendTo)
Set notessession = Nothing
End Function