[WordPress] 外掛分享: Gmail SMTP

WordPress 外掛 Gmail SMTP 的封面圖片。

前言介紹

  • 這款 WordPress 外掛「Gmail SMTP」是 2015-11-11 上架。
  • 目前有 10000 個安裝啟用數。
  • 上一次更新是 2025-04-16,距離現在已有 17 天。
  • 外掛最低要求 WordPress 6.5 以上版本才可以安裝。
  • 外掛要求網站主機運作至少需要 PHP 版本 5.6 以上。
  • 有 100 人給過評分。
  • 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。

外掛協作開發者

naa986 |

外掛標籤

mail | smtp | email | gmail | oauth |

內容簡介

Gmail SMTP 外掛可讓您利用 Gmail SMTP 伺服器驗證您的 Gmail 帳戶,並透過該 SMTP 伺服器寄送電子郵件。

大多數共用主機伺服器在處理電子郵件時都有限制。通常電子郵件會突然消失或被攔截,有時當您的網站達到每日可寄送電子郵件的限制時,也會遭到攔截。使用此外掛即可繞過此問題,透過 Gmail 的 SMTP 伺服器進行郵件路由。

Gmail SMTP 附加元件

回覆地址
Cc 抄送功能

Gmail SMTP 優點

Gmail SMTP 外掛不同於大部份 SMTP 外掛,它使用 OAuth 2.0 協定來授權存取 Gmail API。這表示一種更安全的登入系統,使用者不必輸入任何使用者名稱或密碼。
Gmail SMTP 外掛使用 PHPMailer,一套非常受歡迎的寄送電子郵件函式庫,用於透過 PHP 的 mail 功能寄送電子郵件。此函式庫也用於核心 WordPress 寄送電子郵件。
Gmail SMTP 外掛利用「wp_mail」(WordPress 用於寄送電子郵件的函數)而非完全覆蓋它。這樣一來,您仍然可獲得預設 mail 函數的所有優點。
您不再需要啟用「允許較不安全的應用程式」來解決 SMTP 連線問題。這個問題自 2014 年 12 月以來就變得突出,當時 Google 開始對他們的應用程式實施 XOAUTH2 認證(基於 OAuth2)。此問題仍然影響了幾乎所有 SMTP 外掛,因為它們是通過使用者名稱和密碼進行驗證的。

OAuth 2.0 授權的運作方式

您的應用程式註冊在 Google 開發人員控制台內。
啟動應用程式,並請求您致授權以存取您 Google 帳戶內的資料。
如果您同意,應用程式將收到存取 Gmail API 所需的憑證。

Gmail SMTP 功能

設定您的網站以使用 Gmail SMTP 伺服器寄送電子郵件
使用 OAuth 2.0 協定進行驗證
寄送電子郵件時使用加密驗證(TLS/SSL)

Gmail SMTP 基礎設定

在 Google 開發人員控制台中建立新專案。
啟用 Gmail API。
建立可存取此 API 的憑證(OAuth 客戶端 ID)。
為此 Web 應用程式設定同意頁面。
輸入產品名稱和隱私政策 URL。
完成設置同意頁面後,建立 Web 應用程式。
進入外掛程式設定 (設定->Gmail SMTP)。
將應用程式的授權重新導向 URL 設定為設定區域內顯示的 URL。
完成創建 Web 應用程式。
複製新建立的客戶端 ID 和客戶端密碼,並貼到設定區域內。
輸入您的 OAuth Email、寄件人 Email 和寄件人姓名。
選擇一種加密方式。
輸入連接埠號碼。
儲存設定。
現在,您可點擊「授權職權」按鈕來授權您的應用程式以存取 Gmail API。
當應用程式已被授權之後,Gmail SMTP 外掛就能完全管理所有寄出的電子郵件。

Gmail SMTP 設定

合法重導向 URI:您網站的合法重導向 URL。您需要將此 URL 複製到您的 Web 應用程式中。
用戶端 ID:您的 Web 應用程式所使用的客戶端 ID。

原文外掛簡介

Gmail SMTP plugin allows you to authenticate with your Gmail account to send email via Gmail SMTP server.

Most shared hosting servers have restrictions when it comes to email. Usually email will get blocked or missing for no reason. Sometimes it will get blocked when your website reaches the daily limit of outgoing email. This plugin can bypass this issue by routing the email through Gmail’s SMTP server.
Gmail SMTP Add-ons

Reply-To
Cc

Gmail SMTP Benefits

Gmail SMTP plugin is not like most SMTP plugins. It uses the OAuth 2.0 protocol to authorize access to the Gmail API – which means a more secure login system and users won’t have to enter any username or password.
Gmail SMTP plugin uses PHPMailer – a very popular library used for sending email through PHP’s mail function. This libary is also used in the core WordPress to send email.
Gmail SMTP plugin utilizes “wp_mail” (A function used by WordPress to send email) instead of completely overriding it. This way you still get all the benefits of the default mail function.
You no longer need to enable Allow less secure apps on your gmail account to fix SMTP connection issue. This issue became prominent from December 2014, when Google started imposing XOAUTH2 authentication (based on OAuth2) to access their apps. This issue still affects almost all the SMTP plugins because they authenticate via username and password.

How OAuth 2.0 Authorization Works

You register an application in the Google Developers Console.
The application is launched and it requests that you give it access to data in your Google account.
If you consent, the application receives credentials to access the Gmail API.

Gmail SMTP Features

Configure your website to send email using Gmail SMTP server
Authenticate using OAuth 2.0 protocol
Authenticate with encryption when sending an email (TLS/SSL)

Gmail SMTP Basic Setup

Create a new project in Google Developers Console.
Enable Gmail API in it.
Create credentials (OAuth client ID) to access this API.
Configure the consent screen for the web application.
Enter a Product Name and a Privacy policy URL.
Once the consent screen is configured, create a web application.
Go to the plugin settings (Settings->Gmail SMTP).
Set the Authorized Redirect URL of the application as the one shown in the settings.
Finish creating the web app.
Copy the newly created Client ID and Client secret and paste into the settings area.
Enter your OAuth Email, From Email and From name.
Select an encryption.
Enter a port number.
Save the settings.
Now you can authorize your application to access the Gmail API by clicking on the Grant Permission button.
Once the application has been authorized Gmail SMTP plugin will be able to take control of all outgoing email.

Gmail SMTP Settings

Authorized Redirect URI: Authorized redirect URL for your website. You need to copy this URL into your web application.
Client ID: The client ID of your web application.
Client secret: The client secret of your web application.
OAuth Email Address: The email address that you will use for SMTP authentication. This should be the same email used in the Google Developers Console.
From Email Address: The email address which will be used as the From Address when sending an email.
From Name: The name which will be used as the From Name when sending an email.
Type of Encryption: The encryption which will be used when sending an email (TLS/SSL. TLS is recommended).
SMTP Port: The port which will be used when sending an email. If you choose TLS it should be set to 587. For SSL use port 465 instead.
Disable SSL Certificate Verification: As of PHP 5.6 a warning/error will be displayed if the SSL certificate on the server is not properly configured. You can check this option to disable that default behaviour.

Gmail SMTP Test Email
Once you have configured the settings you can send a test email to check the functionality of the plugin.

To: Email address of the recipient.
Subject: Subject of the email.
Message: Email body.

For detailed setup instructions please visit the Gmail SMTP plugin page.

各版本下載點

  • 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
  • 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Gmail SMTP」來進行安裝。

(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。


1.0.5 | 1.0.6 | 1.0.7 | 1.0.8 | 1.0.9 | 1.1.0 | 1.1.1 | 1.1.2 | 1.1.9 | 1.2.0 | 1.2.3.5 |

延伸相關外掛(你可能也想知道)

文章
Filter
Apply Filters
Mastodon