WordPress Useful Plugin – 使用 WP Mail SMTP 透過 GMail 來寄信
在 WordPress 實用外掛推薦 有提到 WP Mail SMTP by WPForms & Post SMTP Mailer/Email Log 都是 WordPress 的寄信外掛程式,它可以讓 WordPress 透過本機或外部的郵件主機來寄發信件。
- WP Mail SMTP by WPForms 功能說明
- WP Mail SMTP by WPForms 透過 Goole API 方式寄信的設定
- 建立 Google Cloud IAM 專案
- 建立 Google API 憑證
- 電子郵件測試驗證
- WP Mail SMTP by WPForms 功能說明
WP Mail SMTP by WPForms 它不使用預設的 mail()
函式,而是重新設定 wp_mail()
函式,它在 設定->一般 畫面,可以點選 Gmail/Mailgun/SendGrid/SMTP 等其中一種郵件程式,經過相關設定就可以寄信了。
WP Mail SMTP plugin includes many different SMTP setup options:
- Sendinblue SMTP (Recommended)
- Mailgun SMTP
- SendGrid SMTP
- Gmail SMTP
- Microsoft SMTP (Outlook.com and Office 365) [Pro]
- Amazon SES SMTP [Pro]
- All Other SMTP
- WP Mail SMTP by WPForms 透過 Goole API 方式寄信的設定
若想要參考原文來設定,可以參考它的說明文件: Gmail documentation ,這樣 WordPress 就可以透過 Goole API 的方式寄信。
- 建立 Google Cloud IAM 專案
接下來是記錄本站實際的安裝過程:安裝完 WP Mail SMTP by WPForms 後,要先設定 用戶端 ID 、用戶端密碼,而 已授權的重新導向 URI 則是要填入 Goole API 憑證認證後的返回網址。要取得這相關資料,就必需先如原文說: sign into your Gmail account and access Gmail’s application registration. 就是先登入 Gmail 的帳號然後到 https://console.developers.google.com/flows/enableapi?apiid=gmail&pli=1 這裡去建立一個專案。若已經有專案了,可以直接使用,否則就選擇「建立專案」。
- 建立 Google API 憑證
專案名會自動產生,並進入要引導建立憑證的畫面,專案名日後可以透過管理資源的頁面來修改。在將憑證新增至專案裡的資訊,API 的呼叫來源選:網路伺服器 ( 例如: node.js, Tomcat ),而存取什麼資料則請選 使用者資料。
然後,它會要求要提供給使用者的 OAuth 同意畫面 ,並要求您送交驗證。
接下來它會提供此 Google API 的 用戶端 ID 、用戶端密碼 ,而 已授權的 JavaScript 來源 及 已授權的重新導向 URI 則是必填的,這樣子就取得相關的資料可以填入 WP Mail SMTP by WPForms 中對於 透過 Goole API 方式寄信的相關資料了。
日後若有需要修改憑證相關的 JavaScript 來源 及 已授權的重新導向 URI 時,可以到 API 和服務 -> 憑證 作維護。
- 電子郵件測試驗證
最後可以透過它提供的 電子郵件測試 作驗證,若有收到測試信件就代表成功了。
你必須 登入 才能發表評論。