I became a remote worker and needed an email to my boss I want to automate because the same content and regular transmission are sent every day!
I'm not accepting opinions that it's too analog lol chat is not good
・ Easy to make and share with team members ・ I want to execute on time with the task scheduler
Office 365 Windows 10
Considering the internal environment, Java, Node.js or Python? I thought about Power Automate of Office 365, but I stopped it because it is difficult to use and it is difficult to share it with other members
This time, we will focus on ease of use and use Python. (Because there was training in the past, all members should be included)
At first I thought I would send it via the Office 365 API, It may be troublesome around the proxy when making a request.
As I investigated, there is a library that can handle Office applications from Python, It seems that the requirements can be met, so I will adopt that
First, install the library (pywin32) Launch a command prompt with administrator privileges and install with pip
And easy coding By the way, the Python version is 3.7.4
sendmail.py
import win32com.client as win32
outlook = win32.Dispatch('outlook.application')
mail = outlook.CreateItem(0)
mail.To = '[email protected] (shipping address)'
mail.Subject = 'Good morning'
mail.Body = 'Start business'
#Attachments, comment out if necessary
# attachment = "Absolute path of attachment"
# mail.Attachments.Add(attachment)
mail.Send()
When I actually executed it, I was able to send an email. Set the task scheduler to start 10 minutes before the start of work and complete.
I will use it for a while and if there is no problem, I will distribute it to everyone on the team.
・ Python is too light and I'm worried if it really works ・ It's nice to have a little time to spare
·that? It's okay to make a reservation for sending in Outlook ... ()