File: //home/arjun/projects/buyercall_forms/buyercall/buyercall/blueprints/admin/tasks.py
from flask import current_app
from buyercall.lib.util_ses_email import send_ses_email
from buyercall.app import create_celery_app
from buyercall.blueprints.issue.models import Issue
celery = create_celery_app(current_app)
@celery.task()
def deliver_support_email(issue_id, subject, message, **kwargs):
"""
Send a contact message to the person who sent an issue.
:param issue_id: Id of the issue
:type issue_id: int
:param subject: E-mail subject
:type subject: str
:param message: E-mail message
:type message: str
:return: None
"""
issue = Issue.query.get(issue_id)
if issue is None:
return
send_ses_email(recipients=[issue.email],
p_id=issue.partnership_id,
subject=subject,
text=message)
return None