def test_send_email_not_verified(ses_client): aws_ses_client = AwsSesClient(region='eu-west-1') source = "*****@*****.**" to_address = "*****@*****.**" subject = "Email subject" body = "Email body" try: message_id = aws_ses_client.send_email(source, to_address, subject, body) except AwsSesClientException as e: assert 'Did not have authority to send from email [email protected]' in str(e)
def test_send_email(ses_client): aws_ses_client = AwsSesClient(region='eu-west-1') source = "*****@*****.**" to_address = "*****@*****.**" subject = "Email subject" body = "Email body" # All source email addresses have to be verified before you # can send on behalf of them. ses_client.verify_email_identity(EmailAddress=source) message_id = aws_ses_client.send_email(source, to_address, subject, body) assert message_id