[PYTHON] Automatically send emails with Amazon SES

Note that I used SES for automation of email sending at work

Email address verification

You need to authenticate your email address The user you just created is in the SES sandbox, so both the source and destination need to be authenticated. If you move it out of the sandbox as described below, you will be able to send to destinations that have not been verified.

Send an authentication email to the email address used in Identity Management-> Email Addresses-> Verify New Email Address.

Screen Shot 2017-08-08 at 16.19.50.png

Click the link in the email and verify that the Status to the right of the email is verified.

Lifting sandbox restrictions

Log in to the console and issue an SES transmission restriction release request from the support center. It will be canceled in 1 to 2 days.

Screen Shot 2017-08-08 at 16.21.44.png

Reference: http://docs.aws.amazon.com/ja_jp/ses/latest/DeveloperGuide/request-production-access.html

Transmission test


import boto3
 
client = boto3.client('ses', region_name='us-east-1')
response = client.send_email(
    Source='[email protected]',
    Destination={
        'ToAddresses': ['[email protected]']
    },
    Message={
        'Subject': {
            'Data': 'hello',
        },
        'Body': {
            'Text': {
                'Data': 'hello ses.',
            }
        }
    })

Recommended Posts

Automatically send emails with Amazon SES
Send an email with Amazon SES + Python
Easily send emails with Gmail with Django
Send email with Django
I can't send emails from Lambda in a VPC with Boto3 using a VPC endpoint for SES
I tried sending an email from Amazon SES with Python
Automatically download images with scraping
Send Japanese email with Python3
Face recognition with Amazon Rekognition
Achieve "Bals" with Amazon Echo
Send using Python with Gmail