[Outlook] I tried to automatically create a daily report email with Python

Overview

You can make a daily report template from this site, I can't put today's date in the subject line ** automatically **!

I want you to automatically create a daily report email! I thought, I put it into practice

code

import win32com.client
import datetime


#send e-mail
object = win32com.client.Dispatch("Outlook.Application")
mail = object.CreateItem(0) 
mail.BodyFormat = 1

#Destination setting To,CC,Bcc
mail.To = "[email protected]"
# mail.cc = "[email protected]"
# mail.Bcc = "[email protected]"

#Get today's date
today = datetime.datetime.now()
#Email subject
mail.Subject = "Daily report[{}Month{}Day]".format(today.month,today.day)

#Email body
mail.Body = """\
thank you for your hard work.
I will send you a daily report.

<What I did>

<What I found>

<What to do next>

that's all
"""

 #View the created email
mail.Display(True)

 #send e-mail
# mail.Send()

Execution result

--I was able to compose an email!

Summary

I was able to automatically create a daily report email!

reference

To be able to call the mail template (Outlook) [Python] Send email with outlook

Recommended Posts

[Outlook] I tried to automatically create a daily report email with Python
I tried to automatically create a report with Markov chain
I tried to automatically generate a password with Python3
I tried to create a list of prime numbers with python
I tried to create a program to convert hexadecimal numbers to decimal numbers with python
I tried to create a table only with Django
I tried to draw a route map with Python
When I tried to create a virtual environment with Python, it didn't work
I tried to easily create a fully automatic attendance system with Selenium + Python
Create a Mastodon bot with a function to automatically reply with Python
I tried to automatically generate a character string to be input to Mr. Adjustment with Python
I tried scraping food recall information with Python to create a pandas data frame
I tried to create a linebot (implementation)
I tried to create a linebot (preparation)
I tried a functional language with Python
[5th] I tried to make a certain authenticator-like tool with python
[2nd] I tried to make a certain authenticator-like tool with python
A memorandum when I tried to get it automatically with selenium
[Python] A memo that I tried to get started with asyncio
I tried to make a periodical process with Selenium and Python
I tried to make a 2channel post notification application with Python
I tried to create Bulls and Cows with a shell program
I tried to make a todo application using bottle with python
[4th] I tried to make a certain authenticator-like tool with python
[1st] I tried to make a certain authenticator-like tool with python
I tried to improve the efficiency of daily work with Python
I tried to automatically collect images of Kanna Hashimoto with Python! !!
Python: I tried to make a flat / flat_map just right with a generator
I tried to communicate with a remote server by Socket communication with Python.
I made a tool to automatically browse multiple sites with Selenium (Python)
I want to create a window in Python
I want to make a game with Python
I tried to get CloudWatch data with Python
I tried to output LLVM IR with Python
I tried to make a traffic light-like with Raspberry Pi 4 (Python edition)
I tried to create a plug-in with HULFT IoT Edge Streaming [Execution] (3/3)
I tried to discriminate a 6-digit number with a number discrimination application made with python
Steps to create a Twitter bot with python
I tried to automate sushi making with python
I tried to send a registration completion email from Gmail with django.
I tried sending an email with SendGrid + Python
I tried to create a plug-in with HULFT IoT Edge Streaming [Setup] (1/3)
I tried to build a Mac Python development environment with pythonz + direnv
I tried to create a sample to access Salesforce using Python and Bottle
I want to write to a file with Python
I tried to make a periodical process with CentOS7, Selenium, Python and Chrome
I tried to create a class that can easily serialize Json in Python
I tried to create a button for Slack with Raspberry Pi + Tact Switch
I tried to create a model with the sample of Amazon SageMaker Autopilot
I tried to automatically send the literature of the new coronavirus to LINE with Python
I tried to implement Minesweeper on terminal with python
I tried to get started with blender python script_Part 01
I tried to touch the CSV file with Python
I tried to solve the soma cube with python
I tried to automatically read and save with VOICEROID2
I tried to get started with blender python script_Part 02
I tried to implement an artificial perceptron with python
I want to work with a robot in python.
I want to manually create a legend with matplotlib
I tried to solve the problem with Python Vol.1
I want to send a business start email automatically