hi Kokulan Eswaranathan (கோகுலன் ஈஸ்வரநாதன்),
we need to add some more think to your code to work i have attached my working code.
Thank you so much kokul.
Entity template = GetGlobalTemplate("Auto mail configuration for scheduling Risk Review", service);
Entity email = new Entity("email");
Entity from = new Entity("activityparty");
from["partyid"] = new EntityReference("systemuser", ContextObject.context.UserId);
tracingService.Trace("from:" + ContextObject.context.UserId.ToString());
Entity[] SendFrom = { from };
email["from"] = SendFrom;
EntityCollection colAP = new EntityCollection();
string[] emailname = {"srv@gmail.com", "abc@gmail.com" };
foreach (var emailAddress in emailname)
{
if (!string.IsNullOrWhiteSpace(emailAddress))
{
Entity toParty = new Entity("activityparty");
toParty.Attributes.Add("addressused", emailAddress);
colAP.Entities.Add(toParty); ;
}
}
email["to"] = colAP;
Guid EmailId = service.Create(email);
// Guid EmailId = service.Create(email);
SendEmailFromTemplateRequest emailtempreq = new SendEmailFromTemplateRequest
{
Target = email,
TemplateId = template.Id,
RegardingId = targetEntity.Id,
RegardingType = "opportunity"
};
SendEmailFromTemplateResponse emailtempresp = (SendEmailFromTemplateResponse)service.Execute(emailtempreq);
Regards,
Muthukumaran M,
L&T Infotech,
Karaikal,
Chennai.
India