2

I tried to send mail form C# using my outlook account but I don't want the notification pop up window to be appeared when trying to send mails.

Any idea to disable the notifications windows?

Here my code snippent:

 public static void SendEmail(string _ToEmail, string _Subject, string _EmailBody)
    {       
        Microsoft.Office.Interop.Outlook.Application oApp = new Microsoft.Office.Interop.Outlook.Application(); 
        Microsoft.Office.Interop.Outlook.MailItem email = (Microsoft.Office.Interop.Outlook.MailItem)(oApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem));
        email.Recipients.Add(_ToEmail);         
        email.Subject = _Subject;                      
        email.Body = _EmailBody;         
        ((Microsoft.Office.Interop.Outlook.MailItem)email).Send(); 
    }
Anuraj
  • 18,859
  • 7
  • 53
  • 79
Ragaei Mahmoud
  • 447
  • 2
  • 11
  • 26

1 Answers1

2

The popup you´re seeing is a security feature of outlook. The only chance to avoid it, is to disable this feature in outlook itself. If you really think this is the way to go for you, try to google something like "disable outlook security warning", or check this thread How to avoid Outlook security alert when reading outlook message from C# program this should point you to the right direction.

Community
  • 1
  • 1
Dominik
  • 3,342
  • 1
  • 17
  • 24