GoogleOAuthSMTP plugin
From LimeSurvey Manual
GoogleOAuthSMTP is a core plugin that lets LimeSurvey send email through a Gmail or Google Workspace account using OAuth2, instead of a plain SMTP username and password. This is required because Google no longer allows "less secure apps" / plain password sign-in for sending mail through its SMTP servers — an app has to authenticate with an OAuth2 token instead.
Setting it up
1. Create OAuth 2.0 credentials in Google Cloud
In the Google Cloud Platform Console, create an OAuth 2.0 Web Application credential. When asked for an authorized redirect URI, use the exact URI shown on this plugin's own settings page (Configuration -> Plugin manager -> GoogleOAuthSMTP -> Settings) — it will look similar to:
https://your-limesurvey-domain/index.php/admin/smtpOAuth/sa/receiveOAuthResponse
See Google's documentation on setting up OAuth 2.0 for details on creating the credential itself. Once created, note down the Client ID and Client Secret Google gives you.
2. Activate the plugin
Go to Configuration -> Plugin manager and activate GoogleOAuthSMTP. It ships inactive by default.
3. Enter your credentials
Open the plugin's settings (Configuration -> Plugin manager -> GoogleOAuthSMTP -> Settings) and fill in:
- Client ID
- Client Secret
Save the settings.
4. Authorize with your Google account
Still on the plugin's settings page, click Get new token (or Get token). This opens a popup window showing Google's consent screen. Log in with the Google account that should send LimeSurvey's email, and accept the requested permissions. Once done, the popup closes itself automatically and the settings page updates.
After a successful authorization, the settings page shows the Token owner email address: the Google account that was just authorized. All outgoing mail will be sent from this address — there is no separate "sender address" setting.
5. Select this plugin as the email method
Go to Configuration -> Global settings -> Email settings and set:
- Email method: Plugin
- Email plugin: Google
Once "Plugin" is selected, the regular SMTP host/username/password/encryption fields are hidden and no longer used — this plugin connects to Gmail's SMTP server directly and does not read those fields at all.
To confirm everything works, use the regular Send test email button on the same Email settings tab — there is no separate test button specific to this plugin.
Status and troubleshooting
The plugin's settings page shows a status message reflecting the current state of its configuration:
- Configuration is complete (or similar): a valid, working refresh token is stored — nothing to do.
- Requirement not met: typically means the site is not being served over HTTPS.
- Credentials incomplete: Client ID and/or Client Secret are not filled in yet.
- No token: Client ID/Secret are set, but authorization (step 4) has not been completed yet.
- Invalid token: a token was obtained previously, but Google no longer accepts it (for example, because access was revoked from the Google account, or too much time has passed). Click Get new token again to re-authorize.
If the Google account's access is revoked, or the OAuth consent is otherwise invalidated outside of LimeSurvey, sending mail will fail (visible as a send error/exception, and in the log) until the site is re-authorized — this is not proactively flagged to administrators outside of the plugin's own settings page.
Limitations
- No separate "from" address can be configured — outgoing mail is always sent as the Google account used to authorize the plugin.
- Client ID, Client Secret and the stored refresh token are kept in the database without encryption, unlike LimeSurvey's own SMTP password field (which is encrypted). Treat access to Plugin Manager settings and to the database itself as access to these credentials.
- Gmail overrides the visible "From" header with the authenticated account's address regardless of a survey's configured "From" name/address; the plugin works around this by adding that configured address as a Reply-To header, so replies still reach the intended recipient even though the visible sender is the authorized Gmail account.
- There is no dedicated per-plugin test/send button; use the generic "Send test email" button under Global settings -> Email settings.