Error on amazon SES: SendEmail operation: Illegal addres
Question:
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?
Answers:
Try to remove the following:
ReplyToAddresses=[],
ReturnPath='',
ReturnPathArn='',
SourceArn='',
Apparently they can’t be empty!
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]',
],
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?
Try to remove the following:
ReplyToAddresses=[],
ReturnPath='',
ReturnPathArn='',
SourceArn='',
Apparently they can’t be empty!
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]',
],