有一天 Jenkins 不再寄發建置結果通知信,追查原因是因為 Google 更新了一項安全性政策:
為保護您的帳戶安全,自 2022 年 5 月 30 日起,如果第三方應用程式或裝置只要求您以使用者名稱和密碼登入 Google 帳戶,Google 將不再支援這些應用程式或裝置。
不過這也不是沒有退路,我們可以改使用應用程式密碼登入帳戶。
開啟兩步驟驗證功能
要使用應用程式密碼登入帳戶,必須開啟兩步驟驗證功能,我們到 Google 帳戶的設定底下,切換到安全性
頁籤,裡面有一個兩步驟驗證
,點擊它照著指引將兩步驟驗證功能開啟。

產生應用程式密碼
兩步驟驗證功能開啟之後,在原來的設定畫面的下面,會多出一個應用程式密碼
,預設是「無
」的狀態。

點擊它進入應用程式密碼產生頁面,在「選取應用程式
」選項中,選擇「其他(自訂名稱)
」。

輸入自訂的應用程式名稱之後,點擊「產生
」。

我們會得到一串密碼,將這串密碼複製起來備用。

最後,我們回到我們自己服務的設定畫面,把 SMTP 的登入密碼換成剛剛產生的應用程式密碼,就大功告成了。
