You need to sign in to do that
Don't have an account?
Nikhil
How to use for Messaging.MassEmailMessage
Hi Forum members,
I am trying to send emails via Messaging.MassEmailMessage in Apex trigger.
I am not able to save the trigger
Code i used for that is
/////////////////////////////////////
trigger mytrigger on Account (after update)
{
if (Trigger.isAfter && Trigger.isUpdate)
{
String[] toAddresses = new String[]{'xyz@abc.com', 'ijk@abc.com'};
Messaging.MassEmailMessage mail = new Messaging.MassEmailMessage();
mail = new Messaging.MassEmailMessage();
mail.setToAddresses(toAddresses);
mail.setPlainTextBody(' test mails ');
mail.setSenderDisplayName('ABCD corp') ;
Messaging.sendEmail(new Messaging.MassEmailMessage[] {mail});
}
}
/////////////////////////////////////
now i am not able to save this cause,i think i am missing something in this cause mail object of Messaging.MassEmailMessage is not recognizing "setToAddresses" method and other methods
Please advice the right way to use this for massmailing
My requirement is to post emailbody to various contacts
Thanks
Nikhil
Message Edited by Nikhil on 10-22-2008 12:36 AM
I am trying to send emails via Messaging.MassEmailMessage in Apex trigger.
I am not able to save the trigger
Code i used for that is
/////////////////////////////////////
trigger mytrigger on Account (after update)
{
if (Trigger.isAfter && Trigger.isUpdate)
{
String[] toAddresses = new String[]{'xyz@abc.com', 'ijk@abc.com'};
Messaging.MassEmailMessage mail = new Messaging.MassEmailMessage();
mail = new Messaging.MassEmailMessage();
mail.setToAddresses(toAddresses);
mail.setPlainTextBody(' test mails ');
mail.setSenderDisplayName('ABCD corp') ;
Messaging.sendEmail(new Messaging.MassEmailMessage[] {mail});
}
}
/////////////////////////////////////
now i am not able to save this cause,i think i am missing something in this cause mail object of Messaging.MassEmailMessage is not recognizing "setToAddresses" method and other methods
Please advice the right way to use this for massmailing
My requirement is to post emailbody to various contacts
Thanks
Nikhil
Message Edited by Nikhil on 10-22-2008 12:36 AM
For mass email, try passing in a list of contact object IDs...
Also, FYI in your code above, you are instantiating the mass email object twice, both when you declare it, and then the line below that.... You can delete that second one.
Message Edited by eyewell on 10-22-2008 01:35 PM
Hi Nikhil,
I'm trying to use the mass email like you and I encoutered the same problem you mentioned.
Did you succeed?
Thanks,
Message Edited by Sami Cohen on 12-12-2008 01:32 AM