Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from flask import Flask
- from flask_mail import Mail, Message
- import os
- app = Flask(__name__)
- app.config.update(
- MAIL_SERVER = 'smtp@gmail.com',
- MAIL_PORT = 465,
- MAIL_USE_SSL = True,
- MAIL_USERNAME = 'emailku@gmail.com',
- MAIL_PASSWORD = 'emailkupass123'
- )
- mail = Mail(app)
- @app.route('/')
- def index():
- msg = Message(subject="Hello",
- sender='emailpengirim@gmail.com',
- recipients=["alsaskarmirando@gmail.com"], # replace with your email for testing
- body="This is a test email I sent with Gmail and Python!")
- mail.send(msg)
- return 'Email berhasil dikirim'
- if __name__ == '__main__':
- app.run(debug=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement