from lib.flask_mailplus import send_template_message
from snakeeyes.app import create_celery_app

celery = create_celery_app()


@celery.task()
def deliver_contact_email(email, message):
    """
    Send a contact e-mail.

    :param email: E-mail address of the visitor
    :type user_id: str
    :param message: E-mail message
    :type user_id: str
    :return: None
    """
    ctx = {'email': email, 'message': message}

    send_template_message(subject='[Snake Eyes] Contact',
                          sender=email,
                          recipients=[celery.conf.get('MAIL_USERNAME')],
                          reply_to=email,
                          template='contact/mail/index', ctx=ctx)

    return None

from flask import current_app

from lib.flask_mailplus import send_template_message
from snakeeyes.app import create_celery_app

celery = create_celery_app()


@celery.task()
def deliver_contact_email(email, message):
    """
    Send a contact e-mail.

    :param email: E-mail address of the visitor
    :type user_id: str
    :param message: E-mail message
    :type user_id: str
    :return: None
    """
    ctx = {'email': email, 'message': message}

    send_template_message(subject='[Snake Eyes] Contact',
                          sender=email,
                          recipients=[current_app.config['MAIL_USERNAME']],
                          reply_to=email,
                          template='contact/mail/index', ctx=ctx)

    return None

Fix contact form recipient email address
Fix contact form recipient email address

Since Celery is configured differently now we can't reach in and
grab config values outside of Celery.

+ from flask import current_app
+ 
  from lib.flask_mailplus import send_template_message
  from snakeeyes.app import create_celery_app
  
  celery = create_celery_app()
  
  
  @celery.task()
  def deliver_contact_email(email, message):
      """
      Send a contact e-mail.
  
      :param email: E-mail address of the visitor
      :type user_id: str
      :param message: E-mail message
      :type user_id: str
      :return: None
      """
      ctx = {'email': email, 'message': message}
  
      send_template_message(subject='[Snake Eyes] Contact',
                            sender=email,
-                           recipients=[celery.conf.get('MAIL_USERNAME')],
+                           recipients=[current_app.config['MAIL_USERNAME']],
                            reply_to=email,
                            template='contact/mail/index', ctx=ctx)
  
      return None
  
Fix contact form recipient email address
## Code Before:
from lib.flask_mailplus import send_template_message
from snakeeyes.app import create_celery_app

celery = create_celery_app()


@celery.task()
def deliver_contact_email(email, message):
    """
    Send a contact e-mail.

    :param email: E-mail address of the visitor
    :type user_id: str
    :param message: E-mail message
    :type user_id: str
    :return: None
    """
    ctx = {'email': email, 'message': message}

    send_template_message(subject='[Snake Eyes] Contact',
                          sender=email,
                          recipients=[celery.conf.get('MAIL_USERNAME')],
                          reply_to=email,
                          template='contact/mail/index', ctx=ctx)

    return None

## Instruction:
Fix contact form recipient email address
## Code After:
from flask import current_app

from lib.flask_mailplus import send_template_message
from snakeeyes.app import create_celery_app

celery = create_celery_app()


@celery.task()
def deliver_contact_email(email, message):
    """
    Send a contact e-mail.

    :param email: E-mail address of the visitor
    :type user_id: str
    :param message: E-mail message
    :type user_id: str
    :return: None
    """
    ctx = {'email': email, 'message': message}

    send_template_message(subject='[Snake Eyes] Contact',
                          sender=email,
                          recipients=[current_app.config['MAIL_USERNAME']],
                          reply_to=email,
                          template='contact/mail/index', ctx=ctx)

    return None
