Hello,
You need to assign the
replacestring array to
SourceParameters of a
MacroResolver class and use it as a input parameter of the
SendEmailWithTemplateText method.
Please take a look at following code snippet:
EmailMessage msg = new CMS.EmailEngine.EmailMessage();
EmailTemplateInfo eti = EmailTemplateProvider.GetEmailTemplate("myTemplate", CMSContext.CurrentSiteID);
MacroResolver resolver = new MacroResolver();
string[,] replacestring = new string[2, 2];
replacestring[0, 0] = "username";
replacestring[0, 1] = Profiles[x].username;
replacestring[1, 0] = "password";
replacestring[1, 1] = Profiles[x].password;
resolver.SourceParameters = replacements;
msg.EmailFormat = EmailFormatEnum.Both;
msg.From = eti.TemplateFrom;
msg.Recipients = "name@domain.com";
msg.Subject = eti.TemplateSubject;
msg.Body = eti.TemplateText;
EmailSender.SendEmailWithTemplateText(CMSContext.CurrentSiteName, msg, eti, resolver, true );
I hope this will help.
Best regards,
Michal Legen