Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Reference the attachment page and pass in the account ID
- PageReference pdf = Page.VF_IncidentDetail_PDF3;
- pdf.getParameters().put('id',(String)recId); //
- pdf.setRedirect(true);//false
- // Take the PDF content
- Blob b = pdf.getContent();
- // Create the email attachment
- Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
- efa.setFileName('attachment.pdf');
- efa.setBody(b);
- addresses = 'spandan@bbb.com';
- // if (account.Contacts[0].Email != null) {}
- addresses += ':' + 'anilkumar.lingaraju@abbvie.com'+':'+'tumpu1985@gmail.com'+':'+'saikat.neogy@cognizant.com' ;
- String[] toAddresses = addresses.split(':', 0);
- // Sets the paramaters of the email
- email.setSubject( 'Incident Details');
- email.setToAddresses( toAddresses );
- email.setPlainTextBody( body );
- email.setFileAttachments(new Messaging.EmailFileAttachment[] {efa}); // Sends the email
- Messaging.SendEmailResult [] r =
- Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});
- return pdf;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement