+ Start a Discussion
YonathanYonathan 

Email attachment Compression

Hi all,

 

Here is my code :

 

public void sendEmail(string attach,string body) { Blob fileBody = Blob.valueOf(attach); Messaging.EmailFileAttachment[] fileAttachments = new Messaging.EmailFileAttachment[1]; Messaging.EmailFileAttachment fileAttachment = new Messaging.EmailFileAttachment(); fileAttachment.setBody(fileBody); fileAttachment.setFileName('users.xml'); fileAttachments[0] = fileAttachment; Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); ... mail.setPlainTextBody(body); mail.setFileAttachments(fileAttachments); Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail }); }

 

 

Is it possible to programmatically create and compress a file to be attached in email ?