【发布时间】:2020-06-26 15:39:43
【问题描述】:
我正在努力实现:
电子邮件已发送到 Outlook“已发送邮件”文件夹,因此电子邮件是 不在“发件箱”文件夹中。
由于递送失败,电子邮件未返回(电子邮件将在 “收件箱”文件夹由 postmaster@mail.hotmail.com 投递)
以下代码用于通过 Outlook 从 Access 表单发送电子邮件:
Private Sub cmdEmail1_Click()
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Dim strBody As String
Dim strPDF As String
Dim strFolder As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
strBody = Me.txtSubject
strPDF = Me.txtFile
On Error Resume Next
With OutMail
.To = Me.txtemail
.CC = ""
.BCC = Me.txtBBCemail
.Subject = Me.txtSubject
.Body = Me.txtMessage
.Recipients.ResolveAll
' .SendUsingAccount = OutApp.Session.Accounts.Item(2) '2nd email
.SentOnBehalfOfName = Me.txtFromEmail
.Attachments.Add strPDF 'attachments
.Send
End With
Me.txtSent = "email was sent to Outlook "
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
非常感谢
诺伯特
【问题讨论】:
-
您能澄清一下您的问题吗?
-
我可以建议SendGrid 代替吗?见MS Access send email
-
cmdEmail1 过程是从 MSAccess 调用的,目的是检查电子邮件是否在 Outlook 的“已发送邮件文件夹”中,而无需通过向 Access 发送标志来打开 Outlook。 (我知道这并不能验证收件人收到了电子邮件)。问题是:我需要在 MSAccess 过程中添加哪一行代码来验证电子邮件是否在“已发送邮件文件夹”而不是“发件箱文件夹”中。
标签: vba outlook ms-access-2013