Email sending to multiple mail ID's in frappe

322 Views Asked by At

In frappe erpnext v14, I have created a child table which contains To, CC and BCC fields.. I need to be able to send email to multiple people if I comma separate the mail ID's in To, CC and BCC fields.

frappe.ui.form.on("Policy", {

send: function (frm) {

var recipients = frm.doc.recipients || [];

recipients.forEach(function (recipient) {

  var to = recipient.to;

  var cc = recipient.cc;

  var bcc = recipient.bcc;

  frappe.call({

    method: "frappe.core.doctype.communication.email.make",

    args: {

      recipients: to,

      sender: "[email protected]",

      sender_full_name: "Helpdesk | Ensign",

      cc: cc,

      bcc: bcc,

      content: cur_frm.doc.description,

      subject: cur_frm.doc.subject,

      send_email: 1,

      communication_medium: "Email",

    },

    async: false,

    callback: function (r) {

      console.log("Sending");

      frappe.ui.toolbar.clear_cache();

      dialog.hide();

    },

  });

});

},

});

I used this code.

0

There are 0 best solutions below