'How to prevent prompt for unsafe attachment?
When sending emails with potentially unsafe attachments, Outlook pops up a dialog.
I'm programmatically forwarding all my emails to another account and this pop up message is blocking execution of the macro.
There doesn't seem to be a way to prevent the pop-up programmatically, as the mail.Send method has no arguments.
For Each Item In olFolder.Items
If TypeOf Item Is Outlook.MailItem Then
Dim oMail As Outlook.MailItem: Set oMail = Item
If oMail.Permission = olDoNotForward Then
GoTo for_continue
End If
Set objMail = oMail.Forward
objMail.To = emailTo
' this prompts user input in case of unsafe attachments
objMail.Send
End If
for_continue:
Next
How to go around this so the macro runs without constant intervention?
Solution 1:[1]
If using Redemption (I am its author) is an option, you can modify your code as follows. Change the line
objMail.Send
to
dim sItem As Object
sItem = CreateObject("Redemption.SafeMailItem")
sItem.Item = objMail
sItem.Send
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |

