Advertisement
Guest User

Untitled

a guest
Nov 24th, 2014
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. // Reference the attachment page and pass in the account ID
  2. PageReference pdf = Page.VF_IncidentDetail_PDF3;
  3. pdf.getParameters().put('id',(String)recId); //
  4. pdf.setRedirect(true);//false
  5.  
  6. // Take the PDF content
  7. Blob b = pdf.getContent();
  8.  
  9. // Create the email attachment
  10. Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
  11. efa.setFileName('attachment.pdf');
  12. efa.setBody(b);
  13. addresses = 'spandan@bbb.com';
  14.  
  15.  
  16. // if (account.Contacts[0].Email != null) {}
  17. addresses += ':' + 'anilkumar.lingaraju@abbvie.com'+':'+'tumpu1985@gmail.com'+':'+'saikat.neogy@cognizant.com' ;
  18. String[] toAddresses = addresses.split(':', 0);
  19.  
  20. // Sets the paramaters of the email
  21. email.setSubject( 'Incident Details');
  22. email.setToAddresses( toAddresses );
  23. email.setPlainTextBody( body );
  24.  
  25. email.setFileAttachments(new Messaging.EmailFileAttachment[] {efa}); // Sends the email
  26. Messaging.SendEmailResult [] r =
  27. Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});
  28.  
  29. return pdf;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement