I want to send a business start email automatically

What you want to do with the background

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

Requirements

・ Easy to make and share with team members ・ I want to execute on time with the task scheduler

environment

Office 365 Windows 10

What is your language?

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)

Investigation

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

coding

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()

I sent it

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.

Impressions

・ 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 ... ()

Recommended Posts

I want to send a business start email automatically
I want to start a jupyter environment with one command
I want to start a lot of processes from python
I want to automatically generate a modern metal band name
I want to send a message from Python to LINE Bot
I want to print in a comprehension
I want to build a Python environment
I want to send a signal only from the sub thread to the main thread
I want to identify the alert email. --Is that x a wildcard? ---
I tried to send a registration completion email from Gmail with django.
[Outlook] I tried to automatically create a daily report email with Python
I want to make matplotlib a dark theme
I want to easily create a Noise Model
I want to INSERT a DataFrame into MSSQL
I want to create a window in Python
I want to email from Gmail using Python.
I want to make a game with Python
I don't want to take a coding test
I want to start over with Django's Migrate
How to automatically start a GCP preemptible VM
I want to easily find a delicious restaurant
I want to write to a file with Python
I want to upload a Django app to heroku
[LINE Messaging API] I want to send a message from the program to everyone's LINE
I want to embed a variable in a Python string
I want to easily implement a timeout in python
100 image processing knocks !! (021-030) I want to take a break ...
I want to generate a UUID quickly (memorandum) ~ Python ~
I want to transition with a button in flask
I want to find a popular package on PyPi
I want to easily build a model-based development environment
I want to work with a robot in python.
I want to split a character string with hiragana
I want to install a package of Php Redis
[Python] I want to make a nested list a tuple
I tried to automatically generate a password with Python3
I want to run a quantum computer with Python
I want to do Wake On LAN fully automatically
I want to bind a local variable with lambda
I want a mox generator
Send a signal to subprocess
I want to solve Sudoku (Sudoku)
I want a mox generator (2)
I want to make a blog editor with django admin
[Python] I want to get a common set between numpy
I want to make a click macro with pyautogui (desire)
NikuGan ~ I want to see a lot of delicious meat! !!
I want to automatically attend online classes with Python + Selenium!
I want to make a click macro with pyautogui (outlook)
I want to use a virtual environment with jupyter notebook!
[Django] I want to log in automatically after new registration
[Visualization] I want to draw a beautiful graph with Plotly
I want to make input () a nice complement in python
I want to create a Dockerfile for the time being.
I want to record the execution time and keep a log.
If you want to become a data scientist, start with Kaggle
I want to automatically find high-quality parts from the videos I shot
I want to use a wildcard that I want to shell with Python remove
I tried to make it possible to automatically send an email just by double-clicking the [Python] icon
A memorandum when I tried to get it automatically with selenium
I want to understand systemd roughly