I’m trying to send an email. The email is sending, but it’s taking too much time. I used flush()
as well, but I’m getting an error in the Doctype. Can anyone please tell me how to send the email faster?
if doc.status == "Pending for Hospital Opinion":
patient_name = doc.patient_name or "N/A"
hosp_name = doc.hospital_name or "N/A"
doct_name = doc.preferred_doctor or "N/A"
# lead_id = doc.apollo_lead_uid or "N/A"
tr_id = doc.name or "N/A"
frappe.sendmail(
template="medical_opinion_email_template",
recipients=frappe.session.user,
subject=f"Patient – {patient_name} – Acknowledgement of New Treatment Request with Apollo Lead UID: ### and Treatment Request ID: {tr_id}",
args={
"patientname": patient_name,
"hospname": hosp_name,
"doctname": doct_name,
"trId": tr_id
}
)