gpt4 book ai didi

vbscript - 使用 Outlook 从网页发送电子邮件

转载 作者:行者123 更新时间:2023-12-03 06:39:55 25 4
gpt4 key购买 nike

我有一个网页,其中有一个按钮,可以将页面上的信件发送给电子邮件收件人。目前我们使用Lotus Notes并通过VB脚本,我们可以创建Lotus Notes的对象,该对象的属性之一是PutInFolder。用户单击电子邮件按钮后,脚本将发送电子邮件并将电子邮件保存在用户计算机上的某个文件夹中。我们公司现在正在切换到 Outlook 2007,我希望用 Outlook 对象做同样的事情。我们的开发只是本地内网,只有少数用户可以访问它。不管怎样,我的问题是我似乎无法找到与 Outlook 应用程序相同的功能。

我确实使用此逻辑发送当前正在工作的电子邮件。有谁知道如何将电子邮件保存在用户的 Outlook 文件夹中?我尝试查找可以调用的属性列表,但找不到任何搜索内容。也许我在搜索中没有正确的终端学。

谢谢。

sub send_mailvb(sendto, sendcc, sendbcc, subject_text, body_text, attachment1, attachment2, attachment3)

'Open mail, adress, attach report
dim objOutlk 'Outlook
dim objMail 'Email item
dim strMsg
const olMailItem = 0
'Create a new message
set objOutlk = createobject("Outlook.Application")
set objMail = objOutlk.createitem(olMailItem)

' Setup send to
objMail.To = sendto

' Setup send cc
If sendcc <> "" Then
objMail.cc = sendcc
End If

' Setup send bcc
If sendbcc <> "" Then
objMail.bcc = sendbcc
End If

'Set up Subject Line
objMail.subject = subject_text

'Add the body

strMsg = body_text & vbcrlf

'Add an attachments
If attachment1 <> "" Then
objMail.attachments.add(attachment1)
End If

If attachment2 <> "" Then
objMail.attachments.add(attachment2)
End If

If attachment3 <> "" Then
objMail.attachments.add(attachment3)
End If

objMail.body = strMsg
objMail.display 'Use this to display before sending, otherwise call objMail.Send to send without reviewing

'Clean up
set objMail = nothing
set objOutlk = nothing

End Sub

最佳答案

供将来引用...我找到了我正在寻找的解决方案。情况还算一团糟。这是修改后的源,用于将发送电子邮件并将其保存到特定文件夹,以防其他人查看。感谢 Tester101 提供了我正在寻找的网站。这又是嵌入在 HTML 页面中的 vbscript。




sub send_mailvb(sendto, sendcc, sendbcc, subject_text, body_text, attachment1, attachment2, attachment3)

'Open mail, adress, attach report

dim objOutlk 'Outlook
dim objMail 'Email item
dim strMsg
dim myInbox
const olMailItem = 0
'Create a new message
set objOutlk = createobject("Outlook.Application")
Set objNameSpace = objOutlk.Session
set objMail = objOutlk.createitem(olMailItem)

Set myNameSpace = objOutlk.GetNamespace("MAPI")

Set myExplorer = objOutlk.ActiveExplorer


' 6 at least on my machine pointed to the Inbox (should be the same as constant olFolderInbox). Within the Inbox I have a folder called Test
Set myExplorer.CurrentFolder = myNameSpace.GetDefaultFolder(6).Folders("Test")
Set myFolder = myExplorer.CurrentFolder

' Setup send to
objMail.To = sendto

' Setup send cc
If sendcc "" Then
objMail.cc = sendcc
End If

' Setup send bcc
If sendbcc "" Then
objMail.bcc = sendbcc
End If

'Set up Subject Line
objMail.subject = subject_text

'Add the body

strMsg = body_text & vbcrlf

'Add an attachments
If attachment1 "" Then
objMail.attachments.add(attachment1)
End If

If attachment2 "" Then
objMail.attachments.add(attachment2)
End If

If attachment3 "" Then
objMail.attachments.add(attachment3)
End If

objMail.body = strMsg
// objMail.display 'Use this to display before sending, otherwise call objMail.Send to send without reviewing


objMail.Save
objMail.Move(myFolder)

objMail.Send

'Clean up
set objMail = nothing
set objOutlk = nothing

End Sub

关于vbscript - 使用 Outlook 从网页发送电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3163011/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com