Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

flask_mail

pip install Flask-Mail
Comment

flask mail

# In your command line run: 
# pip install Flask-Mail

# Then you can start sending emails easily! Enjoy! :)
from flask import Flask
from flask_mail import Mail, Message

app = Flask(__name__)

app.config['MAIL_SERVER']='smtp.gmail.com'
app.config['MAIL_PORT'] = 465
app.config['MAIL_USERNAME'] = 'yourId@gmail.com'
app.config['MAIL_PASSWORD'] = '*****'
app.config['MAIL_USE_TLS'] = False
app.config['MAIL_USE_SSL'] = True // True if Port = 465
mail = Mail(app)

@app.route("/")
def index():
   msg = Message('Hello', sender = 'yourId@gmail.com', recipients = ['someone1@gmail.com'])
   msg.body = "Hello Flask message sent from Flask-Mail"
   
   # You can also use msg.html to send html templates!
   # Example:
   # msg.html = render_template("hello.html") # Template should be in 'templates' folder
   
   mail.send(msg)
   return "Your email has been sent!"

if __name__ == '__main__':
   app.run(debug = True)
Comment

PREVIOUS NEXT
Code Example
Python :: python ceil 
Python :: flask db migrate 
Python :: pandas dataframe select last n columns 
Python :: how to open sound file in python 
Python :: selenium get back from iframe python 
Python :: check if float is integer python 
Python :: python flask mail 
Python :: python get day month year 
Python :: set python 3 as default ubuntu 
Python :: python string to datetime 
Python :: plt imshow python 
Python :: __gt__ 
Python :: export_excel file python 
Python :: list of files to zip python 
Python :: missingno python 
Python :: colab add package 
Python :: python center window 
Python :: Add new column based on condition on some other column in pandas. 
Python :: adding numbers using python function 
Python :: print value of tensor 
Python :: get list of files in directory python 
Python :: export csv 
Python :: selenium assert text on page python 
Python :: python multithreading tutorials 
Python :: how to sort dictionary in python by lambda 
Python :: pandas change multiple column types 
Python :: start virtualenv 
Python :: remove outliers python dataframe 
Python :: add text to pygame window 
Python :: python divide floor 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =