You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Gmail SMTP v1.1.7插件OAuth认证失败求助:发送测试邮件报错334

解决Gmail SMTP v1.1.7插件XOAUTH2认证失败(334错误)的方案

Hey there, let’s work through that XOAUTH2 auth failure (334 error) you’re facing with the Gmail SMTP v1.1.7 plugin. You’ve already got the OAuth keys sorted and the plugin connected, so let’s dive into the most likely fixes:

  • Double-check your OAuth scope permissions
    Gmail’s SMTP requires specific scopes to allow sending emails. Make sure your OAuth client in the Google Developer Console has either the full https://mail.google.com/ scope (most reliable for SMTP) or at minimum https://www.googleapis.com/auth/gmail.send. A too-restrictive scope is a common reason the server rejects the auth request with a 334 error.

  • Validate your OAuth token’s validity and formatting
    A 334 error often means the server is waiting for a properly formatted auth credential. First, confirm your refresh token isn’t expired—try regenerating it in the developer console and updating the plugin with the new token. Also, ensure the plugin is constructing the XOAUTH2 string correctly: it should be base64-encoded and follow this format:

    user=your_email@gmail.com\001auth=Bearer your_oauth_token\001\001
    

    Any mistake in this string structure will trigger the 334 failure.

  • Adjust your SSL verification settings (with caution)
    From your server logs, I see you’ve disabled SSL peer verification (verify_peer => false, etc.). While this might seem like a quick fix, Gmail’s SMTP server enforces strict SSL/TLS standards. Try re-enabling SSL verification by setting verify_peer and verify_peer_name to true, and removing the allow_self_signed option. Disabling verification can cause hidden handshake issues that indirectly break the auth flow.

  • Review your Gmail account security settings

    • If you have two-step verification enabled on your Gmail account, OAuth tokens won’t work—you’ll need to use an App Password instead (generate one in your Google Account’s Security settings).
    • For G Suite (Google Workspace) accounts, check with your admin to ensure they haven’t restricted SMTP access or OAuth permissions for your account.

Your Error Context:

错误信息:Gmail SMTP, CLIENT -> SERVER: AUTH XOAUTH2, SMTP ERROR: AUTH command failed: 334

服务器日志片段:

2018-04-15 00:46:32 Connection: opening to smtp.gmail.com:587, timeout=300, options=array (
  'ssl' => array (
    'verify_peer' => false,
    'verify_peer_name' => false,
    'allow_self_signed' => true,
  ),
)
2018-04-15 00:46:33 Connection: opened

内容的提问来源于stack exchange,提问作者Matas Vaitkevicius

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.25 03:52:24