-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathemail_handler.py
More file actions
40 lines (31 loc) · 1.03 KB
/
email_handler.py
File metadata and controls
40 lines (31 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import boto3
class email_handler():
def __init__(self):
self.ses_client = boto3.client("ses", region_name="us-west-2")
self.source_email = 'Notification <domain@email.com>'
def verify_email_identity(self):
response = self.ses_client.verify_email_identity(
EmailAddress="leandro.cavalcanti@email.com"
)
print(response)
def send_email(self, addresses, subject, content):
CHARSET = "UTF-8"
response = self.ses_client.send_email(
Destination={
"ToAddresses":addresses,
},
Message={
"Body": {
"Html": {
"Charset": CHARSET,
"Data": content,
}
},
"Subject": {
"Charset": CHARSET,
"Data": subject,
},
},
Source=self.source_email,
)
return response