Slide 8
Slide 8 text
2 import boto3
3 import json
4
5 OUR_EMAIL = "ӡӦαΠυͷϝʔϧΞυϨε"
6
7 def send_email(to, reply, subject, body):
8 client = boto3.client('ses', region_name='us-east-1')
9
10 response = client.send_email(
11 Source=OUR_EMAIL,
12 Destination={
13 'ToAddresses': [
14 to,
15 ]
16 },
17 Message={
18 'Subject': {
19 'Data': subject,
20 },
21 'Body': {
22 'Text': {
23 'Data': body,
24 },
25 }
26 },
27 ReplyToAddresses=[
28 reply,
29 ],
30 ReturnPath=OUR_EMAIL
31 )
32
33 def send_inquiry_mail(email, message):
34 send_email(OUR_EMAIL, email, "͍߹Θ໊ͤ݅", message)
35
36 def send_auto_reply_mail(name, email):
37 message = "ࣗಈฦ৴"
38 send_email(email, OUR_EMAIL, "ࣗಈฦ৴໊݅", message)
39
40 def lambda_handler(event, context):
41 email = event["email"]
42 message = event["message"]
43 send_inquiry_mail(email, message)
44 send_auto_reply_mail(email)