23 lines
866 B
Python
23 lines
866 B
Python
from django.core.mail import send_mail
|
||
from django.conf import settings
|
||
|
||
STATUS_LABELS = {
|
||
'viewed': '已查看',
|
||
'interviewing': '面试邀请',
|
||
'hired': '恭喜录用',
|
||
'rejected': '很遗憾未通过',
|
||
}
|
||
|
||
def notify_status_change(application):
|
||
label = STATUS_LABELS.get(application.status)
|
||
if not label or not application.applicant.email:
|
||
return
|
||
from_email = getattr(settings, 'DEFAULT_FROM_EMAIL', 'noreply@offer.com')
|
||
send_mail(
|
||
subject=f'【招聘通知】您投递的"{application.job.title}"状态更新:{label}',
|
||
message=f'您好 {application.applicant.username},\n\n您投递的职位"{application.job.title}"状态已更新为:{label}。\n\n请登录平台查看详情。',
|
||
from_email=from_email,
|
||
recipient_list=[application.applicant.email],
|
||
fail_silently=True,
|
||
)
|