ERPNext Foundation ERPNext Cloud Chat Blog Discuss Frappé* Donate

PDF Attachment in FrappeClient (Python API)

api

#1

I am using frappeclient in python script for sending and email (with attachment).
This is what I’m using:

frappeObj = FrappeClient('https://my_website,'administrator','password');
print(frappeObj);
att="<html><head></head><body><h1>Attachment In Process</h1></body></html>";
attachment=[{"file_url":"my_file_path.pdf","name":"1a0ec47280","is_private":1}]
 
args={ 
 "sender":"email@gmail.com",
 "sendername":"nikhil",
 "recipients":"email@gmail.com",
 "content":"test",
 "subject":"Test-mail-002",
 "send_email":"1", 
 "communication_medium":"Email",
 "Sent_or_received":"Sent",
 "read_receipt":"0",
 "print_html":att,
 "attachments":attachment
 }
print(args);
response =frappeObj.get_api('frappe.core.doctype.communication.email.make',args);
print(response);

I actually want to send directly my pdf in attachment but on passing it to print_html it is passing it as NULL . But on passing an html, it is converting it to pdf and sending. That is what I want to override. If not using that parameter (print_html) results into error.
Already tried attaching pdf directly but it is not getting attached .
Any help/suggestions will be deeply appreciated.

Thank You


Convert Email Body into Attached PDF
#3

Any suggestions will be hugely appreciable. I seriously need help in this

Thank You