Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error on amazon SES: SendEmail operation: Illegal addres

I'm trying to send email through AWS SES, but I'm receiving this error:

botocore.exceptions.ClientError: An error occurred (InvalidParameterValue) when calling the SendEmail operation: Illegal address 

I already verified the email I'm sending to and from. This is my code:

import boto3  client = boto3.client(     'ses',     aws_access_key_id=AWS_ACCESS_KEY,     aws_secret_access_key=AWS_SECRET_KEY )   response = client.send_email(     Destination={         'ToAddresses': [             '[email protected]',         ],     },     Message={         'Body': {             'Html': {                 'Charset': 'UTF-8',                 'Data': 'This message body contains HTML formatting. It can, for example, contain links like this one: <a class="ulink" href="http://docs.aws.amazon.com/ses/latest/DeveloperGuide" target="_blank">Amazon SES Developer Guide</a>.',             },             'Text': {                 'Charset': 'UTF-8',                 'Data': 'This is the message body in text format.',             },         },         'Subject': {             'Charset': 'UTF-8',             'Data': 'Test email',         },     },     ReplyToAddresses=[     ],     ReturnPath='',     ReturnPathArn='',     Source='[email protected]',     SourceArn='', ) 

How can I fix this?

like image 948
Filipe Ferminiano Avatar asked Apr 01 '17 12:04

Filipe Ferminiano


People also ask

Why are the emails that I send using Amazon SES getting marked as spam?

A message placed in a spam folder indicates that Amazon SES has successfully delivered the message to the recipient's mail server (ISP). At this stage, Amazon SES has no control over the message and can't guarantee inbox placement.

What is AWS SES error?

The "Email address is not verified" error occurs for 2 reasons: We are trying to send emails, from identities (email or domain) that are not verified in AWS SES. The AWS SES account is in sandbox mode in that particular region.

How do I create an AWS SES email address?

Open the Amazon SES console at https://console.aws.amazon.com/ses/ . In the left navigation pane, under Configuration, choose Verified identities. In the list of identities, choose the identity you want to configure where the Identity type is Email address and Status is Verified.


2 Answers

Try to remove the following:

    ReplyToAddresses=[],     ReturnPath='',     ReturnPathArn='',     SourceArn='', 

Apparently they can't be empty!

like image 122
tonysepia Avatar answered Oct 08 '22 21:10

tonysepia


Although it isn't applicable to this question, in my case, I was trying to send emails to multiple addresses at the same time.

Having a single email address here helped.

'ToAddresses': [             '[email protected]',         ], 
like image 34
Bilbo Baggins Avatar answered Oct 08 '22 22:10

Bilbo Baggins