small update
This commit is contained in:
parent
038a18cacb
commit
db358fb544
@ -242,7 +242,7 @@ def send_bulk_email(subject, message, recipient_list, request=None, attachments=
|
|||||||
Send bulk email to multiple recipients with HTML support and attachments,
|
Send bulk email to multiple recipients with HTML support and attachments,
|
||||||
supporting synchronous or asynchronous dispatch.
|
supporting synchronous or asynchronous dispatch.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# --- 1. Categorization and Custom Message Preparation (CORRECTED) ---
|
# --- 1. Categorization and Custom Message Preparation (CORRECTED) ---
|
||||||
|
|
||||||
agency_emails = []
|
agency_emails = []
|
||||||
@ -303,10 +303,10 @@ def send_bulk_email(subject, message, recipient_list, request=None, attachments=
|
|||||||
|
|
||||||
job_id=job.id
|
job_id=job.id
|
||||||
sender_user_id=request.user.id if request and hasattr(request, 'user') and request.user.is_authenticated else None
|
sender_user_id=request.user.id if request and hasattr(request, 'user') and request.user.is_authenticated else None
|
||||||
|
|
||||||
# Loop through ALL final customized sends
|
# Loop through ALL final customized sends
|
||||||
|
|
||||||
|
|
||||||
task_id = async_task(
|
task_id = async_task(
|
||||||
'recruitment.tasks.send_bulk_email_task',
|
'recruitment.tasks.send_bulk_email_task',
|
||||||
subject,
|
subject,
|
||||||
@ -315,7 +315,6 @@ def send_bulk_email(subject, message, recipient_list, request=None, attachments=
|
|||||||
sender_user_id,
|
sender_user_id,
|
||||||
job_id,
|
job_id,
|
||||||
hook='recruitment.tasks.email_success_hook',
|
hook='recruitment.tasks.email_success_hook',
|
||||||
|
|
||||||
)
|
)
|
||||||
task_ids.append(task_id)
|
task_ids.append(task_id)
|
||||||
|
|
||||||
@ -376,7 +375,7 @@ def send_bulk_email(subject, message, recipient_list, request=None, attachments=
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Failed to send email to {recipient}: {str(e)}", exc_info=True)
|
logger.error(f"Failed to send email to {recipient}: {str(e)}", exc_info=True)
|
||||||
|
|
||||||
|
|
||||||
# Send Emails - Pure Candidates
|
# Send Emails - Pure Candidates
|
||||||
for email in pure_candidate_emails:
|
for email in pure_candidate_emails:
|
||||||
candidate_name = Application.objects.filter(email=email).first().first_name
|
candidate_name = Application.objects.filter(email=email).first().first_name
|
||||||
@ -398,7 +397,7 @@ def send_bulk_email(subject, message, recipient_list, request=None, attachments=
|
|||||||
'recipients_count': successful_sends,
|
'recipients_count': successful_sends,
|
||||||
'message': f'Email processing complete. {successful_sends} email(s) were sent successfully to {total_recipients} unique intended recipients.'
|
'message': f'Email processing complete. {successful_sends} email(s) were sent successfully to {total_recipients} unique intended recipients.'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
error_msg = f"Failed to process bulk email send request: {str(e)}"
|
error_msg = f"Failed to process bulk email send request: {str(e)}"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user