emailupdate
This commit is contained in:
parent
ef188ca5e4
commit
82092a475a
@ -1534,7 +1534,6 @@ def send_job_closed_notification(job_id):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def send_bulk_email_task(
|
def send_bulk_email_task(
|
||||||
recipient_emails,
|
recipient_emails,
|
||||||
subject: str,
|
subject: str,
|
||||||
@ -1559,6 +1558,37 @@ def send_bulk_email_task(
|
|||||||
context=context,
|
context=context,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# The return value is stored in the result object for monitoring
|
||||||
|
return json.dumps({
|
||||||
|
"status": "success",
|
||||||
|
"count": processed_count,
|
||||||
|
"message": f"Attempted to send email to {len(recipient_emails)} recipients. Service reported processing {processed_count}."
|
||||||
|
})
|
||||||
|
|
||||||
|
def send_single_email_task(
|
||||||
|
recipient_emails,
|
||||||
|
subject: str,
|
||||||
|
template_name: str,
|
||||||
|
context: dict,
|
||||||
|
) -> str:
|
||||||
|
"""
|
||||||
|
Django-Q task to send a bulk email asynchronously.
|
||||||
|
"""
|
||||||
|
from .services.email_service import EmailService
|
||||||
|
|
||||||
|
if not recipient_emails:
|
||||||
|
return json.dumps({"status": "error", "message": "No recipients provided."})
|
||||||
|
|
||||||
|
service = EmailService()
|
||||||
|
|
||||||
|
# Execute the bulk sending method
|
||||||
|
processed_count = service.send_bulk_email(
|
||||||
|
recipient_emails=recipient_emails,
|
||||||
|
subject=subject,
|
||||||
|
template_name=template_name,
|
||||||
|
context=context,
|
||||||
|
)
|
||||||
|
|
||||||
# The return value is stored in the result object for monitoring
|
# The return value is stored in the result object for monitoring
|
||||||
return json.dumps({
|
return json.dumps({
|
||||||
"status": "success",
|
"status": "success",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user