I'm interested in automating Outlook to check/read mails. I'm using the package win32com with Python to control the app, but I can't find how to open an hyperlink which is in the mail body.
Is there an if or for statement that can open the hyperlink automatically?
Thank you in advance for your help!
I found a way to open the hyperlink with the BeautifulSoup and webbrowser libraries thanks to the HTMLBody property:
from bs4 import BeautifulSoup
import webbrowser
html = mail.HTMLBody #html source code of the mail
soup = BeautifulSoup(html, 'html.parser')
for link in soup.find_all('a'): # will find every <a> tag in the html source code
webbrowser.open(link.get('href')) # will open the url(s)