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

使用Send-MgUserMail发邮件无发件人/正文且遭反垃圾拦截问题

使用Send-MgUserMail通过应用凭据发件触发垃圾邮件拦截,且邮件内容丢失

问题详情

已创建测试应用并配置Microsoft Graph Mail.Send应用权限,使用PowerShell的Send-MgUserMail cmdlet通过应用凭据发送邮件,出现以下问题:

  • 执行脚本后,发件人账号收到未送达报告(NDR),提示邮件因疑似垃圾邮件被拦截
  • 收到的NDR中显示的邮件未包含脚本里设置的发件人信息与正文内容

补充测试:

  • 从内部账号alex@contoso.com向同域账号allan@contoso.com发送仍触发相同NDR
  • 但user1@outlook.com向user2@outlook.com发送可正常送达

执行脚本

Import-Module Microsoft.Graph.Users.Actions
$ClientId = "myappid"
$TenantId = "tenant id of contoso.com"
$ClientSecret = "clientSecret"
$ClientSecretPass = ConvertTo-SecureString -String $ClientSecret -AsPlainText -Force
$ClientSecretCredential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $ClientId, $ClientSecretPass
Connect-MgGraph -TenantId $TenantId -ClientSecretCredential $ClientSecretCredential -NoWelcome
$sender = "alex@contoso.com"
$recipient = "cg@groups.outlook.com"
$subject = "Test mail to cg from alex"
$body = "Come and join us at the biggest tech event!"
$type = "Text"
$save = "false"
$params = @{
Message         = @{
          Subject       = $subject
          Body          = @{
              ContentType = $type
              Content     = $body
          }
          ToRecipients  = @(
              @{
                  EmailAddress = @{
                      Address = $recipient
                  }
              }
          )
      }
      SaveToSentItems = $save
}

Send-MgUserMail -UserId $sender -BodyParameter $params -Verbose

未送达报告(NDR)信息

邮件被内容过滤判定为垃圾邮件,核心错误提示:5.7.1 Message rejected as spam by Content Filtering

已参考多篇教程配置但问题未解决,寻求帮助。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.01 14:47:15