from flask.ext.mail import Message

from app import mail, app


CONFIRM_MESSAGE = """
This email address was recently used to register the username '%s'
at <a href="https://quay.io">Quay</a>.<br>
<br>
To confirm this email address, please click the following link:<br>
<a href="https://quay.io/confirm?code=%s">https://quay.io/confirm?code=%s</a>
"""


def send_confirmation_email(username, email, token):
  msg = Message('Welcome to Quay! Please confirm your email.',
                sender='support@quay.io',  # Why do I need this?
                recipients=[email])
  msg.html = CONFIRM_MESSAGE % (username, token, token)
  mail.send(msg)