You need to sign in to do that
Don't have an account?
Vetriselvan Manoharan
Email attachment visualforce
I am using apex:inputfile to get the file uploaded and want to attach it email attachment and send it as email.. I tried
But I can't able to get the file in the email attachment. Any ideas on how to do it?
public Transient Attachment emailAttachment{get;set;} <apex:inputFile value="{!emailAttachment.body}" filename="{!emailAttachment.name}" id="file"/> List<Messaging.Emailfileattachment> fileList = new List<Messaging.Emailfileattachment>(); if(emailAttachment != null) { Messaging.EmailFileAttachment efa1 = new Messaging.EmailFileAttachment(); efa1.setBody(emailAttachment.Body); efa1.setFileName(emailAttachment.name); fileList.add(efa1); } for(String toContactId : toAddressesList) { List<Messaging.SingleEmailMessage> msgList = new List<Messaging.SingleEmailMessage>(); Messaging.SingleEmailMessage msg = new Messaging.SingleEmailMessage(); msg.setTargetObjectId(toContactId); msg.setFileAttachments(fileList); msg.setHTMLBody(htmlEmailBody); msg.setSubject(EmailSubject); msgList.add(msg); } Messaging.sendEmail(msgList);
But I can't able to get the file in the email attachment. Any ideas on how to do it?
Please find the below link and may be you will get your ans
http://stackoverflow.com/questions/18848444/salesforce-email-attachemnt
https://developer.salesforce.com/forums/?id=906F000000097SRIAY
-Thanks
Ashlekh Gera