function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SteveEthosSteveEthos 

MassEmailMessage Not working at all

We are trying to get the MassEmailMessage to work, but we have been unable.  By searching accross the Discussion Boards, we have found that others are having the same problem, but nobody has posted a solution.
 
Here is our sample code: 
 
List<Id> cIds = new List<Id>();

s_ContactDao cDao = new s_ContactDao();
Contact test = cDao.findLightById('0038000000feeT5');
cIds.add(test.Id);
test = cDao.findLightById('0038000000feeko');
cIds.add(test.Id);
    
Messaging.MassEmailMessage mail = new Messaging.MassEmailMessage();

//-- optional
mail.setSenderDisplayName('joe');
mail.setDescription('email descr');
mail.setSubject('test subject');
mail.setBccSender(false);
mail.setUseSignature(false);
mail.setWhatIds(cIds);

//-- req
mail.setTemplateId('00X80000001DffD');
mail.setTargetObjectIds(cIds);
debug('## getTargetObjectIds: ' + mail.getTargetObjectIds());
List<Messaging.Sendemailresult> resultList = Messaging.sendEmail(new Messaging.Massemailmessage[] { mail } , false);
debug('### result: ' + result);
 
 
Here is the results of the first debug:
"## getTargetObjectIds: (0038000000feeT5AAI, 0038000000feekoAAA)" 
 
 
Here is the result of the second debug: 
 
"result: (Messaging.SendEmailResult[getErrors=(Messaging.SendEmailError[getTargetObjectId=null;]);isSuccess=false;]) 
"
 
There is no valid error message given.  We have gone to the user screen and selected the following options:
 
Mass Email  (Checked)
Send Email   (Checked)
 
The documentation does not help.  Has anyone encountered and solved the same issue?
 
Thanks,
Steve