I am trying to create and send an email using the C# FuelSDK. I can successfully create the email. It shows up in the list of emails. I can also successfully use the API to send the email to an existing List.

However when I look at tracking, it says 'Error' and says it was sent to 0 recipients.

The folks at MC could only share this error message detail and they did not know either.

"An error occurred when attempting to resolve a function call. See inner exception for detail. Function Call: iif(empty(__AdditionalEmailAttribute3),MemberID,__AdditionalEmailAttribute3)"

string clientId = System.Configuration.ConfigurationManager.AppSettings["clientId"];
string clientSecret = System.Configuration.ConfigurationManager.AppSettings["clientSecret"];
int maxEmailsToBeCreated = int.Parse(System.Configuration.ConfigurationManager.AppSettings["maxEmailsToBeCreated"]);

NameValueCollection parameters = new NameValueCollection();
parameters.Add("clientId", clientId);
parameters.Add("clientSecret", clientSecret);

ET_Client myclient = new ET_Client(parameters);

DBStuff context;

using(context = new DBStuff()) {
    var a = from b in context.StuffTable.OrderByDescending(m => m.CreatedDate).Take(maxEmailsToBeCreated) select b;
    var reports = a.ToList();
    foreach(var report in reports) {
        ET_Email email = new ET_Email();
        email.AuthStub = myclient;

        var body = MailBodyBuilder.RenderBody(report);

        email.Name = report.Title;
        email.CustomerKey = report.Id.ToString();
        email.Subject = report.Title;
        email.HTMLBody = body;

        PostReturn response = email.Post();
        Console.WriteLine("Post Status: " + response.Status.ToString());

        ET_Send send = new ET_Send();
        send.AuthStub = myclient;
        send.Email = email;
        send.FromAddress = "***@***.com";
        send.CreatedDate = DateTime.Now;
        send.CreatedDateSpecified = true;
        send.CustomerKey = Guid.NewGuid().ToString();
        send.FromName = "Some Guy";
        send.Subject = report.Title;
        send.IsMultipart = true;
        send.IsMultipartSpecified = true;

        ET_List list = new ET_List();
        list.ID = 123; // The ID of an existing list
        list.IDSpecified = true;

        send.List = new List[1];
        send.List[0] = list;

        FuelSDK.PostReturn postReturn = send.Post();
        Console.WriteLine("Send Status: " + postReturn.Status.ToString());

1 Answer 1


That error is coming from the AMPScript code that exists within the email that is used to render the email at send time. I don't believe there is an issue with the C# code provided there.

  • Thanks. How would you suggest I troubleshoot this? Remove the script and try again? Commented Jul 7, 2016 at 11:48
  • Logging into the Marketing Cloud interface, then in the Email > Content > Emails section the API created email should show up. Select it then use the validate option that may provide a better error message.
    – Mac
    Commented Jul 7, 2016 at 18:30
  • Also, removing the script from the email content would be a good test to confirm that the issue is with that script and not something in your C#.
    – Mac
    Commented Jul 7, 2016 at 18:31
  • The emails all pass the validation. Commented Jul 14, 2016 at 19:25
  • Also, if I just disable 'link tracking' the emails work fine. Another oddity is that if I manually edit the email created from the API, and just add one blank space, then save, the email works normally. Commented Jul 14, 2016 at 19:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .