跳至主要内容

Outlook:如何在没有答复时自动重新发送邮件

Author: Sun Last Modified: 2025-05-07

当你向同事、合作伙伴或他人发送了一封需要紧急回复的邮件,如果在指定时间前未收到回复,你可以设置自动重新发送邮件的功能。

使用提醒和VBA设置无回复时自动重新发送


使用提醒和VBA设置无回复时自动重新发送

 

第一部分:设置一个提醒,在指定时间提醒

1. 右键单击你希望在没有回复时重新发送的邮件(从“已发送邮件”文件夹中),在弹出的上下文菜单中,点击“需后续工作” > “添加提醒”。

doc resend if no response 1

2. 在弹出的“自定义”对话框中,保持“提醒”复选框被勾选,然后在下面的下拉框中选择你希望收到回复的日期和时间,也可以直接在框中输入日期和时间。点击“确定”。

doc resend if no response 1
doc resend if no response 1

第二部分:插入VBA代码以在指定时间内无回复时重新发送邮件

3. 按“Alt” + “F11”键启用“Microsoft Visual Basic for Applications”窗口。

4. 在“项目 - Project1”窗格中双击“ThisOutlookSession”以创建一个空白脚本,并将以下VBA代码复制并粘贴到空白脚本中。

VBA:无回复时重新发送邮件

Public WithEvents GInboxItems As Outlook.Items
'UpdatebyExtendoffice20220413
Private Sub Application_Startup()
  Dim xInboxFld As Folder
  Set xInboxFld = Application.Session.GetDefaultFolder(olFolderInbox)
  Set GInboxItems = xInboxFld.Items
End Sub

'Judge
Private Sub GInboxItems_ItemAdd(ByVal Item As Object)
  Dim xSentItems As Outlook.Items
  Dim xMail As MailItem
  Dim i As Long
  Dim xSubject As String
  Dim xItemSubject As String
  Dim xSendTime As String
  On Error Resume Next
  Set xSentItems = Application.Session.GetDefaultFolder(olFolderSentMail).Items
  If Item.Class <> olMail Then Exit Sub
  For i = xSentItems.Count To 1 Step -1
    If xSentItems.Item(i).Class = olMail Then
      Set xMail = xSentItems.Item(i)
      xSubject = LCase(xMail.Subject)
      xSendTime = xMail.SentOn
      xItemSubject = LCase(Item.Subject)
      If (xItemSubject = "re: " & xSubject) Or (InStr(xItemSubject, xSubject) > 0) Then
        If Item.SentOn > xSendTime Then
           With xMail
             .ClearTaskFlag
             .ReminderSet = False
             .Save
           End With
        End If
      End If
    End If
  Next i
End Sub

'Reminder
Private Sub Application_Reminder(ByVal Item As Object)
  Dim xPrompt As String
  Dim xResponse As Integer
  Dim xFollowUpMail As Outlook.MailItem
  Dim xRcp As Recipient
  On Error Resume Next
  'Resend
  If (Item.Class <> olMail) Then Exit Sub
  xPrompt = "You haven't yet received the reply of " & Chr(34) & Item.Subject & Chr(34) & " within your expected time. Do you want to send a follow-up notification email?"
  xResponse = MsgBox(xPrompt, vbYesNo + vbQuestion, "Kutools for Outlook")
  If xResponse = vbNo Then Exit Sub
  Set xFollowUpMail = Application.CreateItem(olMailItem)
  With xFollowUpMail
    For Each xRcp In Item.Recipients
      .Recipients.Add (xRcp.Address)
    Next
    .Recipients.ResolveAll
    .Subject = "Follow Up: " & Chr(34) & Item.Subject & Chr(34)
    .Body = "Please respond to my email " & Chr(34) & Item.Subject & Chr(34) & " as soon as possible"
    .Attachments.Add Item
    .Display
  End With
End Sub

5. 保存代码后,返回主界面,点击“文件” > “选项”,在“Outlook选项”窗口中,点击左侧的“信任中心”,然后点击“信任中心设置”以启用“信任中心”窗口。点击“宏设置”,确保右侧选择了“启用所有宏(不推荐;可能运行危险代码)”选项。点击“确定” > “确定”。

doc resend if no response 1
doc resend if no response 1

6. 现在,如果设置了提醒的已发送邮件在指定时间到达时仍未收到回复,会弹出一个对话框提醒你是否要重新发送邮件以进行通知。

doc resend if no response 1

7. 点击“是”,会弹出一个消息窗口并附上之前的邮件,你可以重新编辑正文并点击“发送”以重新发送邮件。

doc resend if no response 1

8. 点击“否”,提醒将被删除。

doc resend if no response 1

注意:如果邮件在指定时间之前已被回复,VBA将移除该提醒。