我想对Outlook进行编程,使其预先发送电子邮件,并且,如果在x日期之前未将任何回复发送到目标电子邮件,则发送另一封电子邮件。
我尝试进行实验,尝试使用Excel VBA,但没有找到解决方案。
尽管我确实有编程经验,但是我真的不确定该怎么做。
我想对Outlook进行编程,使其预先发送电子邮件,并且,如果在x日期之前未将任何回复发送到目标电子邮件,则发送另一封电子邮件。
我尝试进行实验,尝试使用Excel VBA,但没有找到解决方案。
尽管我确实有编程经验,但是我真的不确定该怎么做。
我想对Outlook进行编程以预先发送电子邮件
这是非常简单的任务。互联网上有很多示例,例如VB.NET中的示例代码:
Private Sub CreateSendItem(OutlookApp As Outlook._Application)
Dim mail As Outlook.MailItem = Nothing
Dim mailRecipients As Outlook.Recipients = Nothing
Dim mailRecipient As Outlook.Recipient = Nothing
Try
mail = OutlookApp.CreateItem(Outlook.OlItemType.olMailItem)
mail.Subject = "A programatically generated e-mail"
mailRecipients = mail.Recipients
mailRecipient = mailRecipients.Add("Eugene Astafiev")
mailRecipient.Resolve()
If (mailRecipient.Resolved) Then
mail.Send()
Else
System.Windows.Forms.MessageBox.Show(
"There is no such record in your address book.")
End If
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.Message,"An exception is occured in the code of add-in.")
Finally
If Not IsNothing(mailRecipient) Then Marshal.ReleaseComObject(mailRecipient)
If Not IsNothing(mailRecipients) Then Marshal.ReleaseComObject(mailRecipients)
If Not IsNothing(mail) Then Marshal.ReleaseComObject(mail)
End Try
End Sub
在以下文章中了解有关此内容的更多信息:
如果在x日期之前未向目标电子邮件发送任何答复,请发送另一封电子邮件。
您可以在电子邮件上设置以下属性:
在Application.Reminder事件处理程序中,您可以通过读取低级属性值来检查是否已回复或转发邮件项目。您将读取的属性为PR_LAST_VERB_EXECUTED(0x10810003)。值列出如下:
EXCHIVERB_REPLYTOSENDER = 102
EXCHIVERB_REPLYTOALL = 103
EXCHIVERB_FORWARD = 104
请记住,您可以使用PropertyAccessor
:
lastVerbExecuted = mailItem.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x10810003")