|
@@ -26,8 +26,8 @@ from botocore.exceptions import ClientError
|
|
app = FastAPI()
|
|
app = FastAPI()
|
|
|
|
|
|
origins = [
|
|
origins = [
|
|
- "http://172.105.205.52",
|
|
|
|
- "http://172.105.205.52:8001",
|
|
|
|
|
|
+ "http://139.162.121.30",
|
|
|
|
+ "http://139.162.121.30:8002"
|
|
]
|
|
]
|
|
|
|
|
|
app.add_middleware(
|
|
app.add_middleware(
|
|
@@ -104,4 +104,35 @@ async def is_close_changed_notice():
|
|
|
|
|
|
# 寄送逾期執行表單Email通知
|
|
# 寄送逾期執行表單Email通知
|
|
for email in email_list:
|
|
for email in email_list:
|
|
- hhh_send_mail(email, html)
|
|
|
|
|
|
+ #hhh_send_mail(email, html)
|
|
|
|
+ SENDER = "Gorgeous Space <noreply@hhh.com.tw>"
|
|
|
|
+ RECIPIENT = email
|
|
|
|
+ AWS_REGION = "us-east-1"
|
|
|
|
+ CHARSET = "UTF-8"
|
|
|
|
+ client = boto3.client('ses',region_name=AWS_REGION)
|
|
|
|
+
|
|
|
|
+ try:
|
|
|
|
+ msg = MIMEMultipart()
|
|
|
|
+ # msg["Subject"] = "逾期執行表單通知_" + str(datetime.date.today())
|
|
|
|
+ msg["Subject"] = "逾期執行表單通知_" + (datetime.now() + timedelta(hours=8)).strftime("%Y-%m-%d %H:%M")
|
|
|
|
+ msg["From"] = "noreply@hhh.com.tw"
|
|
|
|
+ msg["To"] = email
|
|
|
|
+
|
|
|
|
+ # Set message body
|
|
|
|
+ body = MIMEText(html, "html")
|
|
|
|
+
|
|
|
|
+ msg.attach(body)
|
|
|
|
+
|
|
|
|
+ response = client.send_raw_email(
|
|
|
|
+ Source=msg["From"],
|
|
|
|
+ Destinations=[msg["To"]],
|
|
|
|
+ RawMessage={"Data": msg.as_string()}
|
|
|
|
+ )
|
|
|
|
+ print(response)
|
|
|
|
+
|
|
|
|
+ # Display an error if something goes wrong.
|
|
|
|
+ except ClientError as e:
|
|
|
|
+ print(e.response['Error']['Message'])
|
|
|
|
+ else:
|
|
|
|
+ print("Email sent! Message ID:"),
|
|
|
|
+ print(response['MessageId'])
|