CC and BCC in Sending Email via custom script

I am having trouble with putting cc & bcc options while sending e-mail.
This is the code which is working fine (without cc and bcc):

frappe.call({
      method: "frappe.core.doctype.communication.email.make",
      args: {
      recipients: "my_email@mail.com",
      content: d,
      subject: "Test",
      doctype: "Panel",
      name: cur_frm.doc.name,
      send_email: 1,
      communication_medium: "Email",
      },
      async: false,
      callback: function(rh){
        console.log("mail sent")
      }
     });

After I tracked the parameters in developer’s tool, got to know that format is like this:

recipients:
cc:
bcc:

But its not working via custom script.

Can anyone help me is there any other event which I can use to send mail or I’m missing something

Hello @nikzz

Did you get how to send mail in cc via custom script. i tried but did’t get mail in cc.

Naah, didn’t found any way. Guess we need to parse through backend script for hiw it is actually getting and then can approach for the same

How did you pass cc and bcc? Can you share your code example?

This should work

frappe.call({
	method: "frappe.core.doctype.communication.email.make",
	args: {
		recipients: "my_email@mail.com",
		cc: "cc@mail.com",
		bcc: "bcc@mail.com",
		content: d,
		subject: "Test",
		doctype: "Panel",
		name: cur_frm.doc.name,
		send_email: 1,
		communication_medium: "Email",
	},
	async: false,
	callback: function(rh){
	  console.log("mail sent")
	}
});

@netchampfaris

Where should one put this code ??

That’s exactly what I tried but didn’t worked

No errors? Traceback? How are you debugging it?

Actually no error is occurring. but mail is only sent to email id in recipient, not to cc and bcc

Hi guys

Where should I put this custom script?

I tried it on my local and it worked. No errors.

Where should I add this script to be able.to test it ??

Hi @olamide_shodunke

Trust you’re cool. Looks to me like a standard method so you should be able to call it from the client side by just creating a regular ‘Custom Script’ from the UI. You would probably need some event (like the click of a button) to call the method. The arguments are hard-coded in the example above but they’ll probably be dynamically selected from fields in the doctype in an actual implementation

Cheers

Hi @netchampfaris,

I wanted to send attachments along with that email using client script how i can do that??

Any Idea?