【问题标题】:Mailjet API ignore CC if cc email is null如果抄送电子邮件为空,Mailjet API 会忽略抄送
【发布时间】:2020-06-14 21:31:23
【问题描述】:

如果抄送电子邮件 ID 为空,如何忽略“抄送”。下面是我在 C# 应用程序中添加的代码。如果我们有 To 和 CC Email,邮件会成功触发,没有任何问题。但是,如果 CC Email 为空,则邮件触发器将失败,并且响应显示电子邮件 ID 为空。我尝试插入 if 条件,但没有成功。

MailjetClient client = new MailjetClient(APIKey, SecretKey)
                {
                    Version = ApiVersion.V3_1,
                };
                MailjetRequest request = new MailjetRequest
                {
                    Resource = Send.Resource,
                }
                .Property(Send.Messages, new JArray { new JObject {
                    {"From", new JObject { {"Email", EmailFrom }, { "Name", EmailFromName } } },
                    {"To", new JArray { new JObject { {"Email", Emaildetails.EmailTO } } } },
                    {"Cc", new JArray { new JObject { {"Email", Emaildetails.EmailCC } } } },
                    {"Subject", Emaildetails.EmailSubject},
                    {"HTMLPart", Emaildetails.EmailTemplate}
                 }
             });

【问题讨论】:

    标签: mailjet


    【解决方案1】:

    这是一个猜测,但如果 Emaildetails.EmailCCnull 则不要包含

    {"Cc", new JArray { new JObject { {"Email", Emaildetails.EmailCC } } } },
    

    在你的JObject

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-06-08
      • 1970-01-01
      • 2013-08-28
      • 2012-03-20
      • 2013-01-01
      • 1970-01-01
      • 2021-12-15
      相关资源
      最近更新 更多