---
# System prepended metadata

title: 利用 Gmail SMTP Server 發信
tags: [SMTP]

---

# 利用 Gmail SMTP Server 發信

在 開發過程中 專案 Email 功能測試  可以使用 Gmail 做發信動作

所以 使用 應用程式密碼 作為登入依據

由下方網址進入「應用程式密碼」
https://myaccount.google.com/apppasswords

Google 帳號需要已經設定過兩步驗證登入才能使用「應用程式密碼」

![](https://raw.githubusercontent.com/doom4ster/picgo_image/main/%E6%88%AA%E5%9C%96%202024-09-12%2010.59.15.png)

輸入方便記憶的名稱「Test1」後按下「建立」
![](https://raw.githubusercontent.com/doom4ster/picgo_image/main/%E6%88%AA%E5%9C%96%202024-09-12%2010.59.28.png)

會生成16字元的密碼 不含空格
![](https://raw.githubusercontent.com/doom4ster/picgo_image/main/%E6%88%AA%E5%9C%96%202024-09-12%2010.59.40.png)

這一串字串就可以當 專案操作 SMTP 密碼使用
加密後存在環境變數或是專案設定檔中


使用應用程式密碼登入帳戶 說明
https://support.google.com/mail/answer/185833?hl=zh-Hant

請注意：免費版的Gmail有每日發信 500封 的限制，而企業版的Gmail有每日 2000封 的限制。
相關限制資訊請參閱官方文章
[免費版Gmail的郵件數量限制](https://support.google.com/mail/answer/22839?hl=zh-Hant)
[Google Workspace 的 Gmail 郵件傳送上限](https://support.google.com/a/answer/166852?sjid=8833323460507859195-AP)