I found a script online to resend emails stuck in the Outbox in Outlook 365. It requires that I select the emails.
I have two accounts, including a Microsoft Exchange account. Is there any way to modify this macro so that when I send an email in the Microsoft Exchange account, all emails which may be stuck in the Outbox, are automatically selected and the below macro is run?
Sub BatchResendEmails()
Dim objSelection As Outlook.Selection
Dim objMail As Outlook.MailItem
Dim objInspector As Outlook.Inspector
Dim objResendMail As Outlook.MailItem
Set objSelection = Application.ActiveExplorer.Selection
If Not (objSelection Is Nothing) Then
On Error Resume Next
For Each objMail In objSelection
objMail.Display
Set objInspector = myItem.GetInspector
'Resend message
objInspector.CommandBars.ExecuteMso ("ResendThisMessage")
Set objResendMail = Application.ActiveInspector.CurrentItem
'You can change the email details as per your needs
With objResendMail
.Subject = objMail.Subject
.Send
End With
objMail.Close olDiscard
Next
End If
End Sub