[PYTHON] I tried sending an email from the Sakura server with flask-mail

What did you do?

I sent an email from the Sakura server using flask-mail, which is an extension of the Python framework Flask.

Environment (local)

Python 3.4.2 Flask==0.10.1 Flask-Mail==0.9.1 And Sakura rental server standard plan mail server

Code and supplement

import

script.py


from flask_mail import Mail, Message

Next, the following was added in the form of updating the original config.

script.py


app.config.update(
    MAIL_SERVER='[Domain name].sakura.ne.jp',
    MAIL_PORT=587,
    MAIL_USE_TLS=True,
    MAIL_USERNAME = 'USERNAME',
    MAIL_PASSWORD = 'PASSWORD'
    )

USERNAME is [Name given when making with Sakura's control panel] @ [Domain name] .sakura.ne.jp PASSWORD is the one made with Sakura's control panel Was used respectively.

After that, I could do it according to the official website. https://pythonhosted.org/Flask-Mail/

Recommended Posts

I tried sending an email from the Sakura server with flask-mail
I tried sending an email from Amazon SES with Python
I tried sending an email with SendGrid + Python
I tried using the Python library from Ruby with PyCall
I tried the asynchronous server of Django 3.0
I tried playing with the image with Pillow
Try sending an email with the Gmail API Client Library for Java
I tried to learn the angle from sin and cos with chainer
I tried to send a registration completion email from Gmail with django.
I tried "smoothing" the image with Python + OpenCV
I tried hitting the Qiita API from go
I tried to save the data with discord
I tried "binarizing" the image with Python + OpenCV
I tried to detect an object with M2Det!
I tried playing with the calculator on tkinter
I tried to extract a line art from an image with Deep Learning
[Python] I tried the same calculation as LSTM predict with from scratch [Keras]
Send an email from the VirtualBox CentOS 8 server using your Google account as the sending address and using the app password
I tried to learn the sin function with chainer
I tried to detect the iris from the camera image
I tried to touch the CSV file with Python
I tried to solve the soma cube with python
I tried to implement an artificial perceptron with python
I tried collecting data from a website with Scrapy
I tried to solve the problem with Python Vol.1
I tried to operate from Postman using Cisco Guest Shell as an API server
I tried to make an OCR application with PySimpleGUI
I tried to find an alternating series with tensorflow
I tried hitting the API with echonest's python client
Easy email sending with haste python3
I tried sending an email with python.
I tried sending an email with SendGrid + Python
Send email with Django
Print debug with PyScribe
Validate E-Mail with Python
Send email with Python
I tried sending an email from Amazon SES with Python
Face recognition with Python's OpenCV
Implement subcommands with Python's argparse
Debug Python with VS Code
Debug with PEPPER python interpreter
Send email using Python's smtplib
Debug shared libraries with VScode
I tried sending an email from the Sakura server with flask-mail
I tried to rewrite the WEB server of the normal Linux programming 1st edition with C ++ 14
[Deep Learning from scratch] I tried to explain the gradient confirmation in an easy-to-understand manner.
I made a server with Python socket and ssl and tried to access it from a browser
Sentiment analysis with natural language processing! I tried to predict the evaluation from the review text
I tried the site "Deploy Azure virtual machine from Go"
I tried to find the entropy of the image with python
I tried "gamma correction" of the image with Python + OpenCV
I tried to simulate how the infection spreads with Python
I tried to analyze the whole novel "Weathering with You" ☔️
[Python] Send an email from gmail with two-step verification set
I tried starting Django's server with VScode instead of Pycharm
I tried to notify the train delay information with LINE Notify
I tried replacing the Windows 10 HDD with a smaller SSD
I tried face recognition from the video (OpenCV: python version)
I tried using the DS18B20 temperature sensor with Raspberry Pi
I tried saving the DRF API request history with django-request
I tried to implement the mail sending function in Python
I tried changing the python script from 2.7.11 to 3.6.0 on windows10
I tried to divide the file into folders with Python
I tried to get various information from the codeforces API
I tried to output the access log to the server using Node.js
I tried to create an article in Wiki.js with SQLAlchemy
I tried to build an environment where work in the Docker container on the remote server can be done directly from the local VS Code with SSH connection
I tried fp-growth with python
I tried scraping with Python
I tried Learning-to-Rank with Elasticsearch!
I tried clustering with PyCaret
I tweeted from the terminal!
I tried the changefinder library!
I tried gRPC with Python
I tried scraping with python