You need to sign in to do that
Don't have an account?
Apex developer 21
Exmple how to send notes and attachments form quotes
Can someone give an example how to attach attachments form Quotes to a visualforce email template so that an external receiver kan download the attachments. I have seen many examples but they all require the recever to login to be able to download the. I have found the following example but dont know how to apply this for a visualforce emailtemplate on quotes as a newbie see:
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); String[] toAddresses = new String[]{'user@dimain.com'}; mail.setToAddresses(toAddresses); mail.setReplyTo('user@domain.com'); mail.setSenderDisplayName('SFDC Support'); mail.setBccSender(false); mail.setUseSignature(false); mail.setTargetObjectId('005Q0000000Fo7f'); // Give visualforce template id mail.setTemplateId('00XQ0000000iULj'); mail.saveAsActivity = false; //Set email file attachments List<Messaging.Emailfileattachment> fileAttachments = new List<Messaging.Emailfileattachment>(); for (Attachment a : [select Id, Name, Body, BodyLength from Attachment where ParentId = :oppr]) { // Add to attachment file list Messaging.Emailfileattachment efa = new Messaging.Emailfileattachment(); efa.setFileName(a.Name); efa.setBody(a.Body); fileAttachments.add(efa); } mail.setFileAttachments(fileAttachments); //Send email Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });