You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

MailJet返回成功响应但未发送邮件问题求助

MailJet发送邮件获成功响应但无实际邮件的排查与修复

问题描述

使用MailJet发送测试邮件,API返回带消息ID的成功响应,但实际未收到邮件,MailJet后台显示发送数、送达数均为0。代码示例如下:

private async void button1_Click(object sender, EventArgs e)
{
    await RunAsync();
}

static async Task RunAsync()
{
    MailjetClient client = new MailjetClient("************", "*************");
    MailjetRequest request = new MailjetRequest
    {
        Resource = Send.Resource,
    }
       .Property(Send.FromEmail, "VerifidEemailAddress@domain.com")
       .Property(Send.FromName, "Test Email")
       .Property(Send.Subject, "Test Email Subject")
       .Property(Send.TextPart, "This is a test email!")
       .Property(Send.HtmlPart, "This is a text email!")
       .Property(Send.Recipients, new JArray
            {
                new JObject
                    {
                        {"Email", "ToEmailAddress@gmail.com"}
                    }
           });
    MailjetResponse response = await client.PostAsync(request);
    if (response.IsSuccessStatusCode)
    {
        Console.WriteLine(string.Format("Total: {0}, Count: {1}\n", response.GetTotal(), response.GetCount()));
        Console.WriteLine(response.GetData());
    }
    else
    {
        Console.WriteLine(string.Format("StatusCode: {0}\n", response.StatusCode));
        Console.WriteLine(string.Format("ErrorInfo: {0}\n", response.GetErrorInfo()));
        Console.WriteLine(string.Format("ErrorMessage: {0}\n", response.GetErrorMessage()));
    }
}

可能的问题及修复方案

1. 切换至新版SendV31 API

旧版Send.Resource已被MailJet标记为过时,部分场景下不会触发实际邮件投递。将资源替换为SendV31.Resource,同时调整收件人字段格式:

MailjetRequest request = new MailjetRequest
{
    Resource = SendV31.Resource,
}
.Property(SendV31.FromEmail, "VerifidEemailAddress@domain.com")
.Property(SendV31.FromName, "Test Email")
.Property(SendV31.Subject, "Test Email Subject")
.Property(SendV31.TextPart, "This is a test email!")
.Property(SendV31.HtmlPart, "This is a text email!")
.Property(SendV31.To, new JArray
    {
        new JObject
            {
                {"Email", "ToEmailAddress@gmail.com"},
                {"Name", "Recipient"}
            }
    });

2. 确认API密钥为生产环境密钥

测试环境的API密钥仅用于验证接口有效性,不会实际发送邮件。登录MailJet后台,检查API密钥页面的密钥类型,确保使用的是生产环境密钥。

3. 验证发件人邮箱及域名配置

  • 确认发件人邮箱已完成邮箱验证(点击MailJet发送的验证链接)
  • 检查发件人域名的DKIM、SPF配置是否生效,MailJet后台会显示DNS配置状态,需确保状态为"有效"

4. 优化邮件内容合规性

过于简单的邮件内容可能被反垃圾系统拦截,建议:

  • 丰富邮件内容,避免仅含测试语句
  • 添加必要的退订链接(测试邮件也可临时添加)
  • 确保TextPart和HtmlPart内容一致或互补,避免内容冲突

内容的提问来源于stack exchange,提问作者Vandel212

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.12 21:47:29