The story of making a module that skips mail with python

Overview of what I made

I made a module to skip mail using smtplib or MIMEText. You can send by specifying the subject, body, source, destination, and Cc in the arguments. Since the sender email I was using this time did not require authentication, I have not created an authentication function. Maybe you can do it with server.login. (I haven't tried it ...)

code

mail.py



import smtplib
from email.mime.text import MIMEText

def send_mail(subject, body, f_email, t_email, c_email):
    #Specifying the destination, email subject, and body
    msg = MIMEText(body, "html")
    msg["Subject"] = subject
    msg["To"] = t_email
    msg["From"] = f_email
    msg["Cc"] = c_email  
    #Specify the server. Pass the mail server name and port number to the server and port
    server = smtplib.SMTP(server,port) 
    #send an email
    server.send_message(msg)
    #close
    server.quit()

    return

Recommended Posts

The story of making a module that skips mail with python
The story of making a standard driver for db with python.
The story of making a university 100 yen breakfast LINE bot with Python
The story of making a web application that records extensive reading with Django
The story of making Python an exe
The story of blackjack A processing (python)
A story that struggled to handle the Python package of PocketSphinx
Create a compatibility judgment program with the random module of python.
The story of making a lie news generator
[Python] A rough understanding of the logging module
The story of making a mel icon generator
A story that visualizes the present of Qiita with Qiita API + Elasticsearch + Kibana
The story of making a sound camera with Touch Designer and ReSpeaker
The result of making the first thing that works with Python (image recognition)
The story of making a package that speeds up the operation of Juman (Juman ++) & KNP
A story that didn't work when I tried to log in with the Python requests module
The story of creating a bot that displays active members in a specific channel of slack with python
A story that reduces the effort of operation / maintenance
A story about making 3D space recognition with Python
The story of making a box that interconnects Pepper's AL Memory and MQTT
Around the authentication of PyDrive2, a package that operates Google Drive with Python
A story that struggled with the common set HTTP_PROXY = ~
A story about making Hanon-like sheet music with Python
A memo that I touched the Datastore with python
The story of making a tool to load an image with Python ⇒ save it as another name
[Python] A program that compares the positions of kangaroos.
A story that was convenient when I tried using the python ip address module
A memo of misunderstanding when trying to load the entire self-made module with Python3
The story of implementing the popular Facebook Messenger Bot with python
A story about an amateur making a breakout with python (kivy) ②
The story of rubyist struggling with python :: Dict data with pycall
The story that Python stopped working with VS Code (Windows 10)
A story about an amateur making a breakout with python (kivy) ①
[Python] The first step to making a game with Pyxel
A Python script that compares the contents of two directories
A story about a python beginner stuck with No module named'http.server'
The story of Python and the story of NaN
The story of writing a program
A story stuck with the installation of the machine learning library JAX
The story that the version of python 3.7.7 was not adapted to Heroku
Save the result of the life game as a gif with python
March 14th is Pi Day. The story of calculating pi with python
[python, ruby] fetch the contents of a web page with selenium-webdriver
A function that measures the processing time of a method in python
The story of creating a site that lists the release dates of books
The idea of feeding the config file with a python file instead of yaml
[python] A note that started to understand the behavior of matplotlib.pyplot
[Python] A program that rotates the contents of the list to the left
[Python] A program that creates stairs with #
Pass the path of the imported python module
Make a relation diagram of Python module
Search the maze with the python A * algorithm
The story of making an immutable mold
Check the path of the Python imported module
[python] [meta] Is the type of python a type?
A typed world that begins with Python
The story of making a tool that runs on Mac and Windows at the game development site
[Python] A program that rounds the score
The story of a Parking Sensor in 10 minutes with GrovePi + Starter Kit
[Python] A program that calculates the number of chocolate segments that meet the conditions
If you want a singleton in python, think of the module as a singleton