Skip to content
Advertisement

AWS javascript SDK SES SendMail Illegal Address

I’m attempting to send mail using AWS SES.

Here’s the error I’m seeing:

{
    "message": "Illegal address",
    "code": "InvalidParameterValue",
    "time": "2017-06-02T03:12:37.110Z",
    "requestId": "544c6aee-4741-11e7-9cf5-a709f069aa99",
    "statusCode": 400,
    "retryable": false,
    "retryDelay": 73.04001529701054
}

Here’s the request object being passed in to SendMail method of AWS.SES for javascript SDK.

{
    "Destination": {
        "BccAddresses": [],
        "CcAddresses": [],
        "ToAddresses": [
            "success@simulator.amazonses.com"
        ]
    },
    "Message": {
        "Body": {
            "Html": {
                "Charset": "UTF-8",
                "Data": "You have been removed from Kudo mailing list for account: bob@gmail.com"
            },
            "Text": {
                "Charset": "UTF-8",
                "Data": "You have been removed from Kudo mailing list for account: bob@gmail.com"
            }
        },
        "Subject": {
            "Charset": "UTF-8",
            "Data": "Kudo email removal"
        }
    },
    "ReplyToAddresses": [],
    "ReturnPath": "",
    "ReturnPathArn": "",
    "Source": "donotreply@kudo.io",
    "SourceArn": "arn:aws:ses:us-west-2:1xxxxxxxxxx2:identity/donotreply@kudo.io"
}

bob@gmail.com is verified on my account (which is still in sandbox mode). donotreply@kudo.io is also verified on my account.

Edit: I just tested it by using the test email option in SES and it worked… still can’t get it to send using the SDK though.

Advertisement

Answer

Okay, the key is to remove the empty strings for ReturnPath and ReturnPathArn and SourceArn if you aren’t using it. Once I did that it worked.

Source: https://forums.aws.amazon.com/thread.jspa?messageID=787424&#787424

{
    "Destination": {
        "BccAddresses": [],
        "CcAddresses": [],
        "ToAddresses": [
            "success@simulator.amazonses.com"
        ]
    },
    "Message": {
        "Body": {
            "Html": {
                "Charset": "UTF-8",
                "Data": "You have been removed from Kudo mailing list for account: bob@gmail.com"
            },
            "Text": {
                "Charset": "UTF-8",
                "Data": "You have been removed from Kudo mailing list for account: bob@gmail.com"
            }
        },
        "Subject": {
            "Charset": "UTF-8",
            "Data": "Kudo email removal"
        }
    },
    "ReplyToAddresses": [],
    "Source": "donotreply@kudo.io"
}
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement