34 lines
704 B
Python
Executable File
34 lines
704 B
Python
Executable File
#! /usr/bin/env python3
|
|
|
|
from bottle import get, post, run, template
|
|
import smtplib
|
|
|
|
|
|
def send_confirm_email():
|
|
print('Sending confirmation email')
|
|
host = 'localhost'
|
|
port = 1025
|
|
server = smtplib.SMTP(host, port)
|
|
FROM = "welcome@superbuzz.com"
|
|
TO = "you@example.com"
|
|
MSG = """Subject: Welcome to SuperBuzz!
|
|
|
|
You're just one click away from SuperBuzz bliss! Click this confirmation link:
|
|
[confirmation link].
|
|
"""
|
|
server.sendmail(FROM, TO, MSG)
|
|
server.quit()
|
|
print('Confimration email sent.')
|
|
|
|
|
|
@get('/')
|
|
def home():
|
|
return template('home')
|
|
|
|
@post('/go')
|
|
def go():
|
|
send_confirm_email()
|
|
return template('go')
|
|
|
|
run(host='localhost', port=8080, debug=True)
|