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

Amazon SES是否支持加号寻址?含加号邮箱发送失败求助

解决Amazon SES发送带加号邮箱失败的问题

问题原因

你遇到的错误是因为HTTP协议中,加号(+)会被默认解析为空格字符。当直接传入someone+testing@gmail.com作为收件人地址时,SES服务器会把它解析成someone testing@gmail.com,邮箱本地部分出现了空格,因此触发InvalidParameterValue错误,提示“Local address contains control or whitespace”。

解决方案

对所有邮箱地址参数(包括收件人、发件人)使用rawurlencode()进行编码,确保加号被正确转换为%2B,避免被HTTP协议错误解析。

修改后的PHP代码示例:

"Key"       => "MyKey",
"Secret"    => "MySecret",
"Region"    => "us-east-1",
"Service"   => "email",
"Host"      => "email.us-east-1.amazonaws.com",
"Params"    => [
    "Action"                            => "SendEmail",
    "Destination.ToAddresses.member.1"  => rawurlencode("someone+testing@gmail.com"),
    "Message.Subject.Data"              => urlencode("Test Message"),
    "Message.Body.Html.Data"            => urlencode("<p>Hello, this is a test.</p>"),
    "Source"                            => rawurlencode("sender@example.com")
]

补充说明

Amazon SES本身是支持加号寻址的,问题仅出在旧版REST API的参数传递环节。通过编码特殊字符,让服务器能正确识别原始邮箱地址格式,即可正常发送邮件,无需去掉加号后的后缀部分。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.11 07:25:23