I'm busy automating a process using selenium package in python. My process requires me to send emails using outlook app, but when I try sending emails from python using the code below:
outlook = win32.Dispatch('outlook.application')
mail = outlook.CreateItem(0)
mail.To = 'email_address'
mail.Subject = 'Email Subject'
mail.Body = 'Email Body'
attachment = 'Attachment'
mail.Attachments.Add(attachment)
I get this pop-up from outlook:
Selenium only works for web-based automation, how can I solve this problem using python so that whenever I send an email it automatically clicks on Allow without having to do it manually.
I had a look at my Outlook 2016 Programmatic Access Settings and the Antivirus Status is Invalid:
You get a standard security prompt produced by Outlook when you access any secured property or just send an item. You can read more about that in the "A program is trying to send an e-mail message on your behalf" warning in Outlook article.
There are several ways to avoid such prompts when you send emails:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.