@celery.task
def send_forgot_email(email, ref):
    with app.app_context():
        msg = Message('Recover your Crusade Gaming Account')
msg.recipients = [email]
msg.sender = 'Crusade Gaming stuff@cg.com'
msg.html = (
    """
        Hello Person,<br/>
        You have requested your password be reset. <a href="{0}" >Click here recover your account</a> or copy and paste this link in to your browser: {0} <br />
        If you did not request that your password be reset, please ignore this.
        """
    .format(url_for('account.forgot', ref=ref, _external=True)))
mail.send(msg)
Python Flask with celery out of application context