2

how to write an apex class for contacts and account object and send an email as an attachment by single mail.

I want 2 objects contacts and account object and send an email in 2 different objects in single mail is it possible???

Add multiple Attachments to one email is my direct requiremnt but i am adding 2 object soql queries in one apex class but i am getting only 1st one 2 times as attachments

mail1 .setFileAttachments(new Messaging.EmailFileAttachment[]{csvAttc,csvAttc1});

I am getting csvattc file 2 times as attachment but i am not getting csvattc1 file as attachment

1 Answer 1

1

r u asking is it possible to send email to all the contacts of a account with a attachment..

Have a look a link below it may help...

http://www.salesforce.com/us/developer/docs/pages/Content/pages_email_sending_attachments.htm

4
  • I had already written code seperately for accounts and contacts but i want to send 2 attachments named account.xls and contact.xls files in a single mail Commented Dec 23, 2013 at 14:34
  • i think email.setFileAttachments accepts array of attachments right...
    – user4971
    Commented Dec 23, 2013 at 14:40
  • mail1 .setFileAttachments(new Messaging.EmailFileAttachment[]{csvAttc,csvAttc1}); I had took the above code but i am getting only account.xls file 2 times i am not getting contact.xls file Commented Dec 23, 2013 at 14:48
  • 1
    Check the value you are assigning to the variables csvAttc,csvAttc1 (use system.debug in case required)....
    – user4971
    Commented Dec 23, 2013 at 14:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .