Posted on 05/08/2014 12:36:01
I am using the following code in a cronjob to send newsletter mails at a fixed interval. The cronjob calls an .ashx file.
The problem is, that the email is being send twice to every recipient, but only sometimes. Other times it will send just once.
The code displayed below are the actual code, it it not wrapped in any kind of loop or other iterative method.
Any help would be appreciated.
var email = new Dynamicweb.Modules.EmailMarketing.Email();
email.SenderEmail = "noreply@domain.dk";
email.SenderName = "Domain";
email.Subject = "Nyt fra domain";
email.DomainName = "www.domain.dk";
email.PageId = 241;
var recipientProvider = email.RecipientProvider as AccessUserRecipientProvider;
if (recipientProvider != null)
{
recipientProvider.SetIds(new List<string> { "u7938", "u7917" });
}
email.CreateEmailScheduledTask(DateTime.Now);