23 lines
654 B
Python
23 lines
654 B
Python
from celery import shared_task
|
|
from celery.utils.log import get_task_logger
|
|
from django.conf import settings
|
|
from django.core.mail import EmailMessage, send_mail
|
|
|
|
from templated_email import send_templated_mail
|
|
|
|
logger = get_task_logger(__name__)
|
|
|
|
|
|
COTACT_FORM_TEMPLATE = 'storefront/contact_form'
|
|
|
|
@shared_task(name='contact_form_email')
|
|
def contact_form_email(formdata):
|
|
send_templated_mail(
|
|
template_name=COTACT_FORM_TEMPLATE,
|
|
from_email=formdata['email_address'],
|
|
recipient_list=[settings.DEFAULT_CONTACT_EMAIL],
|
|
context=formdata
|
|
)
|
|
|
|
logger.info(f"Contact form email sent from {formdata['email_address']}")
|