Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

寄信功能確認(e.g. 忘記密碼) #1102

Open
josix opened this issue Nov 13, 2022 · 1 comment · May be fixed by #1167
Open

寄信功能確認(e.g. 忘記密碼) #1102

josix opened this issue Nov 13, 2022 · 1 comment · May be fixed by #1167
Assignees

Comments

@josix
Copy link
Collaborator

josix commented Nov 13, 2022

要替換 [email protected]
https://discord.com/channels/752904426057892052/958314910046117909/974424221277118484

@josix josix moved this from 🔖 Ready to 🆕 New in PyConTW'23 Dev-Web Kanban Nov 13, 2022
@josix josix moved this from 🆕 New to 📋 Backlog in PyConTW'23 Dev-Web Kanban Jan 3, 2023
@changchaishi changchaishi self-assigned this Jan 25, 2024
@changchaishi
Copy link
Contributor

要換 [email protected] 至別的信箱可以

可以使用 Google STMP Relay + Postfix (MTA/SMTP) 達成。

實驗結果:

  1. 先架設一個 Postfix server 在 local, 使用專案 dockerized postfixdocker run --rm --name postfix -e "ALLOWED_SENDER_DOMAINS=gmail.com" -e "RELAYHOST=smtp-relay.gmail.com:25" -p 1587:587 boky/postfix
  2. 使用 python 發起 email, 因爲是 relay 其實不用任何 auth, 讓 google smtp relay 那邊處理
import smtplib
with smtplib.SMTP("127.0.0.1", 1587) as server:
    server.sendmail("[email protected]", "[email protected]", "test email")
  1. local postfix 會嘗試聯係 google smtp 做寄信,以下 log
2024-01-27T15:20:17.261938+00:00 INFO    postfix/smtp[495]: connect to smtp-relay.gmail.com[2404:6800:4008:c07::1c]:25: Cannot assign requested address
2024-01-27T15:20:19.152881+00:00 INFO    postfix/smtp[495]: 0A9ED1FB521: to=<[email protected]>, relay=smtp-relay.gmail.com[64.233.189.28]:25, delay=2.1, delays=0.05/0.02/1.9/0.16, dsn=5.7.0, status=bounced (host smtp-relay.gmail.com[64.233.189.28] said: 550-5.7.0 Mail relay denied [111.71.216.3]. Invalid credentials for relay for 550-5.7.0 one of the domains in:  (as obtained from HELO and MAIL FROM). 550-5.7.0  Email is being sent from a domain or IP address which isn't 550-5.7.0 registered in your Workspace account. Please login to your Workspace 550-5.7.0 account and verify that your sending device IP address has been 550-5.7.0 registered within the Workspace SMTP Relay Settings. For more 550-5.7.0 information, go to 550 5.7.0  https://support.google.com/a/answer/6140680#maildenied n1-20020a634001000000b005ce06f2a3d3sm162744pga.17 - gsmtp (in reply to MAIL FROM command))
2024-01-27T15:20:19.154488+00:00 INFO    postfix/cleanup[494]: 25A0F1FB525: message-id=<20240127152019.25A0F1FB525@eaf077279093>
2024-01-27T15:20:19.159657+00:00 INFO    postfix/qmgr[437]: 25A0F1FB525: from=<>, size=3404, nrcpt=1 (queue active)
2024-01-27T15:20:19.159696+00:00 INFO    postfix/bounce[496]: 0A9ED1FB521: sender non-delivery notification: 25A0F1FB525
2024-01-27T15:20:19.159886+00:00 INFO    postfix/qmgr[437]: 0A9ED1FB521: removed

這個 log 結果是預期的。剩下的就是看有沒有 google workspace owner (pycon.tw domain)可以一起拉實際實驗上去

@SivanYeh SivanYeh moved this to 👀 In review in PyConTW'24 Dev-Web Kanban Mar 25, 2024
@SivanYeh SivanYeh linked a pull request Mar 25, 2024 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📋 Backlog
Status: 👀 In review
Development

Successfully merging a pull request may close this issue.

2 participants