nikzz
April 2, 2019, 4:47am
1
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.
nikzz
May 12, 2019, 4:42am
3
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 ??
nikzz
May 12, 2019, 8:16am
6
That’s exactly what I tried but didn’t worked
No errors? Traceback? How are you debugging it?
nikzz
May 16, 2019, 5:10am
8
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 ??
wale
May 19, 2019, 12:34am
12
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?
CodeOne
February 2, 2023, 5:38am
15
Hello,
I tried this code but I want to send an email template in email.
I tried to do everything my way, but it didn’t work
So how can I do that?