Can't send email through frappe.core.doctype.communication.email.make

Hi,
I am trying to use frappe.core.doctype.communication.email.make to send emails on the creation of statements. This has to be done via a custom script as only statements with customers with emails need to be sent, and the other customers without emailneed to appear in a printout at the end.
Every time I try sending an email I get Object { emails_not_sent_to: null, name: “151f73a4f7” } etc and have checked the source code on frappe but still can’t work out what I am doing wrong. Code is as per below.

frappe.call({
method: “frappe.core.doctype.communication.email.make”,
args: {
sender:"admin@mydomain.com",
sender_full_name:“my company”,
recipients:"test@test.com",
content:“Test Mail”,
subject:“Test-mail-001”,
doctype:“Statement”,
name:r.message.statement.name,
print_html:“Standard”,
print_format:“Standard”,
send_email:true
},

															async:false,
															callback: function (r) {
																if (!r.exc) {
																	console.log(r.message);

Can you share your version and the full trace?

I solved the above question by editing communication.js and got the java script to output to the console. It’ appears the communication medium has to be set, and the send_email is set to 1. as per blow

frappe.call({
method: “frappe.core.doctype.communication.email.make”,
args: {
recipients:"test@example.com",
content:“

Test Mail
HELLO
”,
subject:“Test-mail-001”,
doctype:“Statement”,
name:r.message.statement.name,
send_email:1,
print_format:“Standard”,
communication_medium:“Email”,
Sent_or_received:“Sent”,
read_receipt:0
},
2 Likes

Can we send OTP like this?