add script for testing SES SMTP auth

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2019-08-06 09:41:44 -04:00
parent a686b44782
commit 169a6d1fa8
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
1 changed files with 27 additions and 0 deletions

27
smtp/ses_email.py Executable file
View File

@ -0,0 +1,27 @@
#!/usr/bin/env python3
import smtplib, os
from email.mime.text import MIMEText
sender = 'dapps-approvals@status.im'
receiver = 'dapps-approvals@status.im'
smtp_port = 587
smtp_host = "email-smtp.us-east-1.amazonaws.com"
smtp_user = os.environ["SMTP_USER"]
smtp_pass = os.environ["SMTP_PASS"]
msg = MIMEText('This is test mail')
msg['Subject'] = 'SES SMTP Test mail'
msg['From'] = sender
msg['To'] = receiver
with smtplib.SMTP(smtp_host, smtp_port) as server:
server.ehlo()
server.starttls()
server.ehlo()
server.login(smtp_user, smtp_pass)
rval = server.sendmail(sender, receiver, msg.as_string())
print('mail successfully sent')