@MartinHBramwell Hi…, email is triggered but not delivered, but if I click on send now button in email queue mail is delivered successfully, otherwise it’s keep on retrying for 3 times and ended up with the status of error. Here is the code…,
frappe.call({
method: “frappe.core.doctype.communication.email.make”,
args: {
recipients:to,
sender: “helpdesk@abc.com”,
sender_full_name: “Helpdesk | ABC”,
cc: cc,
bcc: bcc,
content: “Dear Team, Please find the file”,
print_format:“format1”,
subject: subject,
doctype: “Prospect”,
name: cur_frm.doc.name,
send_email: 1,
// attachments: att,
communication_medium: “Email”,
//Sent_or_received: “Sent”,
// read_receipt: 0
},
async: false,
callback: function(r) {
console.log(‘Sending’);
dialog.hide();
frappe.ui.toolbar.clear_cache();
}
});
this is the error log,
wkhtmltopdf reported an error
? whould probably mean the email creation is incomplete, and therefore cannot be sent
1 Like
I think you need to be sure the body of the email is valid HTML
1 Like
Thanks for Your reply. Will check once
1 Like
I guess you are sending an email with attachment of the document.
It is the problem with the wkhtmltopdf and not with the email client.
This might help to root cause. https://discuss.frappe.io/t/frappe-docker-2023-production-setup-password-reset-email-link-added-with-port-8000/101844/11
Is this a way to send print_format within this function?
Are you able to generate pdf from the print menu for the document?
analyse the email content carefully by inspecting the error email. Especially the pdf generation section. Mostly this is due to stylesheet not loaded due to non reachable host.
@gsarunk Yes it is saying “HostNotFoundError” ,How can I resolve that?
again the error indicates a problem with unpatched qt
version. Which version do you have?
I have wkhtmltopdf - 0.12.6
you need the qt patched version
this should work (in theory), but no guarantees
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_amd64.deb;
[ -f "$(ls ./wkhtmltox_0.12.*.deb)" ] && sudo dpkg --install wkhtmltox_0.12.*_amd64.deb;
wkhtmltopdf --version #Test the install: wkhtmltopdf 0.12.6 (with patched qt)