Quantcast
Channel: Emails being sent to strange recipients
Viewing all articles
Browse latest Browse all 9

Re: Emails being sent to strange recipients

$
0
0

In the DoReminderJob method, the template is obtained from a file. Then for each member, a loop runs that replaces some placeholders (##FirstName## and ##DueDate##) with the current member's first name and due date. However, once the replacement has been made for the first member, the placeholders no longer exist for subsequent members, so no replacement is made. You will probably find that it is the same incorrect firstname used in all emails. A quick fix would be to assign the template to a new variable that gets reset for each iteration:

// Replace template with parameters
string body;
foreach (var replacement in replacements)
{
    body = template.Replace(replacement.Key, replacement.Value);
}

//Send the email
var newMail = new Mail();
newMail.FromDisplayName = "CYCANL Admin";
newMail.From = "XXXXX@cycanl.ca";

newMail.SendMail(new[] { email }, "Membership Renewal Reminder", body);


Viewing all articles
Browse latest Browse all 9

Latest Images

Trending Articles





Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>