def send_mail(subject, message, from_address, recipients, logs=None):
if settings.EMAIL_SUBJECT_PREFIX:
subject = str(settings.EMAIL_SUBJECT_PREFIX) + str(subject)
# Convenience method to wrap the tasks and handle the callback
send_mail_task.apply_async(
kwargs={
"subject": subject,
"body": message,
"from_email": from_address,
"to": recipients,
},
link=update_message_status.s([log.pk for log in logs]),
)