我有这种django方法,当经理批准他/她的假期时,它使用sendgrid向员工发送电子邮件。我已经在Gmail电子邮件地址和另一个电子邮件域上对其进行了测试,但是它似乎没有向具有Gmail帐户和另一个电子邮件域的员工发送电子邮件。但是,它将电子邮件发送到其他域上的其他电子邮件地址。我不确定为什么会这样。
def manager_send_email_to_staff(request, staff_id):
to_emails = [staff_id.user.email]
if staff_id.Manager_Authorization_Status == 'Approved':
send_mail("VFSC Leave Application Approved by" + " " + staff_id.Authorized_by_Manager,
"Your annual leave application have been {}".format(
staff_id.Manager_Authorization_Status) + " " + "by your Manager {}".format(
staff_id.Authorized_by_Manager) + " " + "and has now been forward to the "
"Director "
"for the final authorization.\nWe will "
"inform you via email once the Director "
"Authorized your Annual leave",
"VFSC Annual Leave <eLeavesystem@admin.com>", to_emails, fail_silently=False)