ERPNext Foundation ERPNext Cloud Chat Blog Discuss Frappé* Donate

[ Achieved ]Frappe.sendmail : Send email using scheduler with attachments



Hello Community,

I am working on scheduler task in which i want to sent an email on every sunday to the customer whose payment ( Sales Invoice ) are Overdue.

I have done with auto emailing, but how can i attach file in email ?

Like if Customer A has 4 Overdue Invoice then i want to attach all 4 invoice in single mail with template.

Hardik Gadesha


“I have done with auto emailing, but how can i attach file in email”

Good question! You will need to study the existing code, to then develop what you require.

For eg there’s this function

A search on ‘attach_file’ will give you pointers to learn from others?


Thanks For your kind words @clarkej

I have achieved this feature :slight_smile:


@Hardik_Gadesha sharing the steps may help fellow community developers



Yes Sure @hereabdulla

  1. Collect all Overdue Invoice which has status Overdue.
  2. Prepare Content for mail.
  3. Loop through all invoice and adjust all data in content.
  4. Fetch customer email id.
  5. Use frappe.sendmail to send mail.

I hope you got it. Will post detailed solution soon.