![](/img/trans.png)
[英]How to send a email to multiple email address using SES in Lambda function python
[英]Lambda Function(Go) can't send email with SES SMTP
Hello I've followed the instructions here to try and get my lambda function able to send email via SES SMTP https://docs.aws.amazon.com/ses/latest/dg/send-email-set-up-vpc-端點.html
在我的 Lambda Function 中,我使用 net/smtp package,當我嘗試發送 Z0C83ZEF57C786ACECBA4
發送 email 警報撥號 tcp 時出錯:查找 email-smtp.us-east- 1.amazonaws.com .*.1:53:沒有這樣的主機
這是發送給我問題的 email 的代碼。 請注意,當我在本地運行此 Go 代碼時,它工作正常。
user := os.Getenv("SMTP_USER")
password := os.Getenv("SMTP_PASSWORD")
to := []string{
"testemail@gmail.com",
}
addr := "email-smtp.us-east-1.amazonaws.com:587"
host := "email-smtp.us-east-1.amazonaws.com"
msg := []byte("From: test@test.com\r\n" +
"To: test@test.com\r\n" +
"Subject: Test mail\r\n\r\n" +
"Email Body \r\n")
auth := smtp.PlainAuth("", user, password, host)
err = smtp.SendMail(addr, auth, from, to, msg)```
我終於能夠讓 SMTP 正常工作。 OP 中該文檔中的所有內容都是正確的,除了安全組部分。 為了讓它工作,我必須設置我的安全組的入站和出站規則(不完全確定是否需要出站)以使用我的 VPC 中子網的整個 IP 地址范圍用於源/目的地分別。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.