Hi everyone,
I’m sending emails to employees on their birthdays and work anniversaries
The birthday person and ‘teams’ should receive emails. If I add cc to frappe.sendmail, mails are sent to recipients and cc separately. My goal is to send both of them in the same thread.
def send_birthday_reminders_custom():
“”“Send Employee birthday reminders if no ‘Stop Birthday Reminders’ is not set.”“”
to_send = int(frappe.db.get_single_value(“HR Settings”, “send_birthday_reminders”))
if not to_send:
return
employees_born_today = get_employees_who_are_born_today()
for company, birthday_persons in employees_born_today.items():
for person in birthday_persons:
if person['status'] in ['Active', 'Left']:
cc = ['parikshit.rathore@aurigait.com'] if person['status'] == 'Active' else ['anisha.jain@aurigait.com']
birthday_person_names = person['name']
recipients = [person['company_email']]
message = get_birthday_reminder_text_and_message(person)
frappe.sendmail(recipients = recipients,cc = cc,subject=f"Happy Birthday {person['name']}",message = message,expose_recipients = True,)