You need to sign in to do that
Don't have an account?
Rahul Sangwan7341
Now when i am sending a text or CSV file it is working fine but if i am sending PDF,JPEG,Word file it is showing error while i am setting attachment in URL parameter only.
Parse PDF to String
//Code of webservice class to set file as attachment for (String att: attachmentMap.keySet()) { String content = attachmentMap.get(att).toString(); body += '&files[' + att + ']=' + EncodingUtil.urlEncode(content, 'UTF-8'); } // Document doc = [Select Id, Name, body from Document where id='0159000000Bq3oI']; List<String> toEmail = new List<String>(); List<String> ccEmail = new List<String>(); List<String> bccEmail = new List<String>(); toEmail.add('test@gmail.com , test To Name'); String fromEmail = test1@gmail.com'; String subject = 'test subject'; String bodyText = 'test body'; String bodyHtml = '<h1>test body</h1><br/>tested'; String fromName = 'Sangwan'; String replyto = ''; String extheaders = null; Map<String,Blob> attachmentMap = new Map<String,Blob>(); //Blob att = doc.body; attachmentMap.put(doc.Name, doc.body); SendGripApiClass.sendEmail(toEmail, ccEmail, bccEmail, fromEmail, subject, bodyText, bodyHtml, fromName, replyto, extheaders, attachmentMap);Hi I have written code for integration with sendgrid.
Now when i am sending a text or CSV file it is working fine but if i am sending PDF,JPEG,Word file it is showing error while i am setting attachment in URL parameter only.
Shashank (Salesforce Developers)
Would you be able to provide the error message you are seeing?