SMTP Authentication Explained: AUTH Mechanisms, LOGIN, PLAIN & OAuth

SMTP was never designed with a login system at all. Here's exactly how authentication was bolted on afterward, every mechanism still in use today, and how to actually diagnose a failure.

📅 Published August 2026· ⏳ 21 min read· ✍️ ToolsNovaHub Editorial Team
🛠️ Related tool: Open SMTP Tester →

SMTP Was Never Designed to Have a Login

It surprises a lot of people the first time they hear it, but the original SMTP specification — dating back to 1982 — has no concept of authentication whatsoever. Early email ran on a network of trusted, cooperating mail servers where the idea of an anonymous stranger connecting and impersonating a legitimate sender simply wasn't the threat model anyone was designing against. Servers relayed mail for each other on good faith, identified largely by IP address and reverse DNS, with no username, no password, and no login step anywhere in the conversation.

That trust model, unsurprisingly, didn't survive contact with a global, adversarial internet. As spam and unauthorized relay abuse became a serious problem through the 1990s, the need for some way to verify that a connecting client was actually authorized to send mail through a given server became obvious — and rather than redesigning SMTP from scratch, the community added an extension: SMTP AUTH, formalized in RFC 4954. This is why authentication in SMTP feels a little bolted-on compared to protocols designed with login in mind from day one — because it genuinely was bolted on, decades after the original protocol was already in wide use.

ToolsNovaHub Pro Tip
Always confirm you're on an encrypted connection (STARTTLS completed, or implicit TLS on port 465) before troubleshooting an authentication failure. Attempting AUTH mechanisms over plain text is both insecure and, on well-configured modern servers, will simply be refused outright.
⚠️
Common Beginner Mistake
Assuming a '535 Authentication failed' error means your password is definitely wrong. It's frequently caused by the account requiring an app-specific password, missing two-factor app authorization, or a client attempting an unsupported AUTH mechanism — not necessarily an incorrect password at all.

How the AUTH Extension Actually Works

When a client connects to an SMTP server and issues an EHLO command (rather than the older, plainer HELO), a properly configured server responds with a list of extensions it supports, and AUTH — along with the specific mechanisms it accepts — is one of them. The client then picks a supported mechanism, initiates the AUTH exchange with that mechanism named explicitly, and the server and client exchange a short series of base64-encoded messages carrying credentials (or, for OAuth, a token) until the server either accepts (250 response) or rejects (535 response) the attempt. Only after successful authentication does the server typically allow the client to proceed with MAIL FROM, RCPT TO and DATA commands to actually submit a message — without authentication, most modern submission servers refuse to accept any mail at all from an unauthenticated connection.

The Core AUTH Mechanisms Compared

MechanismHow Credentials Are SentEncryption of Credentials ItselfCommon Usage Today
PLAINUsername and password together, base64-encoded, single exchangeNone — relies entirely on TLSVery common, especially over TLS-protected connections
LOGINUsername and password separately, base64-encoded, two exchangesNone — relies entirely on TLSVery common, widely supported by legacy and modern clients alike
CRAM-MD5Challenge-response using an MD5 hash of a server-issued challengePassword itself never transmitted directlyIncreasingly rare; largely superseded by TLS-protected PLAIN/LOGIN
XOAUTH2 (OAuth)Short-lived, revocable access token obtained via a separate OAuth flowToken-based, no long-lived password transmittedStandard for major providers (Gmail, Microsoft 365) enforcing modern security

Why Base64 Encoding Is Not Encryption — a Point Worth Belaboring

This distinction trips up enough people that it's worth spending real time on rather than a single passing mention. Base64 is a simple, entirely reversible way of representing binary data as text — it exists for transmission compatibility, not secrecy, and decoding it requires no key, no password, and no special tool beyond a basic, freely available decoder that takes milliseconds to run. When AUTH PLAIN or AUTH LOGIN sends a base64-encoded username and password, anyone capturing that traffic on an unencrypted connection can recover the original plain-text credentials as easily as reading them directly. The only thing actually protecting those credentials in transit is the TLS layer wrapping the entire connection — either through STARTTLS upgrading a plain connection mid-session, or through the implicit TLS that port 465 starts with immediately. Remove that TLS layer, and AUTH PLAIN/LOGIN offers essentially zero protection against interception, which is exactly why any competently configured mail server refuses to even offer these mechanisms over a connection that hasn't been encrypted first.

OAuth-Based Authentication: Why the Industry Moved This Direction

Password-based authentication, even over TLS, has a structural weakness that has nothing to do with encryption in transit: the password itself is a long-lived, high-value secret that, once known by an application or stored anywhere, remains valid indefinitely until manually changed. If that stored password leaks — through a compromised application, a misconfigured log, or a phishing attack — the attacker has full access until the victim notices and changes it. OAuth-based authentication (XOAUTH2 in SMTP's specific implementation) addresses this by replacing the password with a short-lived access token obtained through a separate, more heavily monitored authorization flow. A leaked token typically has a short expiry window and can be revoked independently of the account's actual password, without requiring the user to change anything else. This is precisely why major providers like Google Workspace and Microsoft 365 have increasingly restricted or deprecated plain password-based SMTP AUTH in favor of requiring OAuth, treating it as a materially stronger security posture rather than a cosmetic preference.

Reading a Real AUTH Exchange

A typical AUTH LOGIN exchange, after STARTTLS has already upgraded the connection, looks roughly like this at the protocol level:

C: AUTH LOGIN
S: 334 VXNlcm5hbWU6
C: [base64-encoded username]
S: 334 UGFzc3dvcmQ6
C: [base64-encoded password]
S: 235 Authentication successful

The 334 responses are the server prompting for the next piece of the exchange (the base64 strings decode to "Username:" and "Password:" respectively), and the final 235 confirms success. A rejected attempt instead returns a 535 response with an explanatory message, at which point the client typically either retries, prompts the user for corrected credentials, or surfaces an error depending on how it's built.

Common Authentication Failure Codes

ResponseMeaningTypical Cause
235Authentication successfulNo action needed — credentials and mechanism were accepted
334Server prompting for next exchange stepNormal mid-handshake response, not an error
454Temporary authentication failureOften a rate limit, temporary server issue, or account lock — usually resolves on retry
501Syntax error in AUTH commandMalformed request, often a client-side bug in how the AUTH command was formatted
530Authentication requiredServer requires AUTH before accepting further commands and none was provided
535Authentication credentials invalidWrong password, unsupported mechanism attempted, or account-specific restriction

Why Authentication Fails Even With a Correct Password

CauseExplanationFix
App-specific password requiredProvider requires a separate generated password for third-party apps rather than the main account password when 2FA is enabledGenerate and use an app-specific password from account security settings
OAuth required, password-based AUTH disabledProvider has disabled plain password AUTH entirely for the account or organizationReconfigure the client to use OAuth/XOAUTH2 instead of a stored password
Wrong AUTH mechanism attemptedClient tries a mechanism the server doesn't support or has disabledCheck the server's EHLO response for supported mechanisms and match the client accordingly
Account locked or suspendedToo many failed attempts, suspicious activity flag, or billing/administrative suspensionCheck account status directly through the provider's admin console
Connecting without TLS firstServer refuses to even offer AUTH mechanisms over an unencrypted connectionEnsure STARTTLS completes successfully (port 25/587) or use implicit TLS (port 465) before attempting AUTH

Client Authentication vs Server-to-Server Relay

It's worth distinguishing clearly between two different trust contexts that both fall under the general umbrella of "SMTP security" but work quite differently. Client submission — a mail client or application sending mail through a provider's server on port 587 or 465 — almost universally requires interactive SMTP AUTH with a username and credential of some kind. Server-to-server relay — one mail server forwarding a message toward its next hop on port 25 — traditionally doesn't use SMTP AUTH at all, relying instead on other trust signals: the sending server's IP being allowlisted, reverse DNS matching expectations, and increasingly, SPF/DKIM/DMARC results evaluated after the fact rather than an interactive login during the connection itself. Confusing these two contexts is a common source of misunderstanding — asking "why doesn't my relay server require a password" when comparing it to a client submission setup is comparing two genuinely different security models, not a misconfiguration.

Testing Authentication in Practice

Beyond a full mail client, command-line tools give a more direct, debuggable view into exactly what's happening during authentication. swaks (Swiss Army Knife for SMTP) is purpose-built for this, letting you specify a username, password, target server, port and desired TLS behavior, then reporting the full protocol exchange including exactly which response code came back and why. openssl s_client can establish the TLS layer manually, after which you can type AUTH commands by hand (base64-encoding credentials yourself) to see precisely how a server responds at each step — considerably more tedious than swaks but useful for understanding exactly what's happening when something isn't working as expected. Use the SMTP Tester to generate the base connectivity commands first, confirming the server is reachable and TLS negotiates correctly, before layering authentication testing on top.

A Brief History of Why AUTH Mechanisms Multiplied Over Time

Looking at the current landscape of AUTH mechanisms — PLAIN, LOGIN, CRAM-MD5, XOAUTH2, and a handful of less common ones like DIGEST-MD5 and SCRAM — it can look unnecessarily fragmented at first glance, but each addition reflects a genuine response to the security and interoperability constraints of its era rather than arbitrary proliferation. AUTH PLAIN and LOGIN emerged early, essentially as the simplest possible way to bolt a username/password exchange onto an existing text-based protocol, with the explicit assumption that TLS would handle the actual security. CRAM-MD5 arrived as a response to environments where TLS wasn't reliably available or trusted, prioritizing not transmitting the password even in encoded form over simplicity. SCRAM (Salted Challenge Response Authentication Mechanism) later improved on CRAM-MD5's design using stronger, salted hashing and addressing some of its more subtle cryptographic weaknesses, though it never achieved the same widespread adoption. XOAUTH2 represents the most recent significant shift, moving away from the password-based model entirely in favor of token-based authentication, driven primarily by large providers wanting stronger control over credential lifecycle, revocation, and scope limitation than any password-based mechanism could offer. Understanding this progression helps explain why a given server might advertise several mechanisms simultaneously — it's often supporting a range of client generations rather than being genuinely undecided about which approach is best.

Provider-Specific Authentication Requirements

ProviderPassword-Based AUTH SupportOAuth SupportNotes
Gmail / Google WorkspaceRestricted; requires app-specific password if 2FA enabledYes, XOAUTH2 widely supported and increasingly requiredHas progressively tightened plain password SMTP access over time
Microsoft 365 / OutlookBeing phased out for many tenant configurationsYes, Modern Authentication (OAuth-based) is the current standardBasic authentication deprecated for many scenarios as of recent policy changes
Generic self-hosted mail serversFully configurable by the administratorPossible but requires additional setup (not default)Security posture depends entirely on how the administrator configures AUTH mechanisms and TLS enforcement
Transactional email providers (SendGrid, Mailgun, etc.)Commonly API-key-as-password pattern over AUTH PLAIN/LOGINSome offer OAuth alternatives depending on the providerAPI-key pattern offers some OAuth-like revocability benefits even while technically using password-based AUTH

Because these requirements shift over time as providers update their security policies, it's worth checking current documentation directly for whichever provider you're integrating with, rather than assuming a configuration that worked previously will continue working indefinitely without adjustment.

Debugging AUTH Failures With Verbose Client Output

Most mail clients and libraries offer some form of verbose or debug logging mode that reveals the actual SMTP protocol exchange rather than just a generic "authentication failed" message surfaced to the end user — and enabling this is almost always the fastest path to understanding what's actually happening. In a programming context, most SMTP libraries (whether in Python, Node.js, PHP, or another language) expose a debug flag that prints each line of the raw protocol conversation, including the exact response code and message text the server returned. This raw output is considerably more informative than a wrapped, library-generated exception message, since it shows you precisely which command the server rejected and why, in the server's own words, rather than a generic error your particular library chose to surface. When reporting an authentication issue to a colleague, a support team, or in a bug report, including this raw exchange (with credentials redacted, of course) rather than just "it doesn't work" dramatically speeds up diagnosis.

Authentication and Rate Limiting: A Frequently Confused Pair

A subtlety worth understanding: some servers apply rate limiting or temporary blocking specifically around authentication attempts, separate from any rate limiting applied to actual mail sending volume. Repeated failed authentication attempts — whether from a genuine credential problem, a misconfigured retry loop in application code, or an actual brute-force attempt — can trigger a temporary lockout on the account or the connecting IP address, which then causes subsequent attempts to fail even with correct credentials, since the account or source is now being actively throttled rather than evaluated normally. This produces a confusing pattern where credentials that were definitely correct suddenly stop working, seemingly at random, and the actual fix is waiting out the lockout period (or contacting the provider to lift it) rather than continuing to retry, which in some cases can extend the lockout further. Applications implementing automated retry logic around SMTP authentication should include reasonable backoff and a hard cap on retry attempts specifically to avoid this self-inflicted lockout scenario.

Expert Tips for Reliable SMTP Authentication

💡
Prefer OAuth Wherever It's Available
For any provider offering XOAUTH2 support, prefer it over plain password-based AUTH — the security and revocability benefits are substantial and increasingly required by major providers regardless.
💡
Never Reuse a Personal Password for Application SMTP
Use dedicated, purpose-specific credentials or app passwords for any application or script sending mail, so a leak doesn't compromise your primary account password.
💡
Confirm TLS Before Debugging AUTH
A failed authentication attempt over a connection that never actually completed TLS negotiation is really a TLS problem wearing an authentication error's clothing — verify the encryption layer first.
💡
Store Credentials Outside Source Code
Use environment variables or a secrets manager for SMTP credentials in application code, never hardcoded directly, to avoid accidental exposure through version control or logs.

Final Word: Treat Authentication as a Security Boundary, Not a Formality

It's easy to treat SMTP authentication as a mechanical hoop to jump through — get the username and password right, get the connection working, move on — but it's worth remembering it's a genuine security boundary protecting your domain's sending reputation and your infrastructure's ability to send mail at all. Credentials that leak can be used to send spam or phishing mail that appears to originate from your systems, damaging domain reputation in ways that take far longer to repair than the leak itself took to happen. Treating credential storage, rotation, and mechanism choice (OAuth over plain passwords wherever available) with the same seriousness applied to any other production credential, rather than as an afterthought bolted onto a mail-sending feature, is the difference between an authentication setup that quietly holds up for years and one that becomes an incident report waiting to happen.

Real-World Use Cases

📧
Configuring a Transactional Email Service
Setting up an application to send password resets and order confirmations through a dedicated SMTP relay provider, using scoped API-key-style credentials rather than a personal mailbox login.
🔐
Migrating to OAuth After a Provider Deprecation
Reconfiguring internal scripts and legacy applications after a major provider announces the end of plain password SMTP AUTH support, moving to XOAUTH2-based authentication instead.
🔍
Diagnosing a Sudden Authentication Break
Investigating why a previously working automated mail script started failing overnight, tracing the cause to a provider-side security policy change requiring an app-specific password.
🛡️
Auditing Credential Storage Practices
Reviewing where and how SMTP credentials are stored across an organization's applications and scripts, replacing hardcoded passwords with a centralized secrets management approach.

A Closer Look at How the AUTH PLAIN Payload Is Constructed

Understanding the actual byte structure of an AUTH PLAIN message clarifies why it's sometimes described as slightly more efficient than AUTH LOGIN despite offering no additional security. The payload is built by concatenating three fields separated by a null byte: an optional authorization identity (usually left empty), the authentication identity (the username), and the password, in the form \0username\0password. This entire string is then base64-encoded and sent as a single argument to the AUTH PLAIN command, rather than the two-step back-and-forth AUTH LOGIN requires. The practical difference is one network round-trip saved — a genuinely minor efficiency gain in most contexts, though it can matter slightly for high-volume automated systems establishing large numbers of connections. Security-wise, the two mechanisms are equivalent: both are exposed in full if intercepted without TLS, and both are equally protected when TLS is properly in place.

Why CRAM-MD5 Seemed Like a Good Idea and Why It Mostly Isn't Used Anymore

CRAM-MD5 was designed to solve a specific problem: what if you wanted to authenticate without ever transmitting the password itself, even in an encoded form, in case TLS wasn't available or trusted? The mechanism works by having the server send a unique, random challenge string, and the client responds with an MD5 hash combining that challenge with the password — meaning an eavesdropper sees only the challenge and the resulting hash, never the password directly, and can't trivially reverse the hash back to the original password. This was a genuinely clever design for its era, and it does still offer real protection against passive eavesdropping without TLS. Its decline in modern usage comes down to a few compounding factors: MD5 itself is now considered a weak, largely broken hash function for security-critical purposes in general (though the specific way CRAM-MD5 uses it is less directly exploitable than MD5's broader cryptographic weaknesses); it doesn't integrate cleanly with modern credential rotation and OAuth-based identity systems; and since TLS is now close to universal for any responsibly configured mail server, the specific problem CRAM-MD5 was built to solve (authenticating safely without encryption) has become largely moot, since nobody should be authenticating without encryption in the first place regardless of which mechanism is used.

Setting Up OAuth-Based SMTP Authentication: A Practical Walkthrough

Configuring XOAUTH2 authentication is meaningfully more involved than simply typing a username and password, which is part of why adoption has been gradual despite its security advantages. The process typically starts with registering an application in the mail provider's developer console (Google Cloud Console for Gmail/Workspace, Azure Active Directory for Microsoft 365), specifying the SMTP-relevant scope the application needs access to, and obtaining a client ID and client secret. From there, the application implements an OAuth authorization flow — for a user-facing application, this usually means redirecting the user to the provider's consent screen where they explicitly grant permission; for a server-side application sending on its own behalf, a service account with domain-wide delegation (where supported) can bypass the interactive consent step. Once authorized, the application receives an access token (short-lived, typically expiring within an hour) and a refresh token (longer-lived, used to obtain new access tokens without re-prompting the user). The SMTP client then uses the current access token, formatted according to the XOAUTH2 specification, in place of a traditional password during the AUTH exchange. Token refresh needs to be handled programmatically, since access tokens expire regularly and the application needs to silently obtain a new one using the refresh token rather than failing or re-prompting a user every hour.

Common Pitfalls When Implementing OAuth SMTP Authentication

PitfallSymptomFix
Access token expired mid-sessionAuthentication that worked minutes ago suddenly fails with no code changesImplement automatic token refresh using the stored refresh token before each send, or on 401/535-style failures
Incorrect XOAUTH2 string formattingAuthentication rejected despite a genuinely valid, unexpired tokenVerify the exact base64-encoded format matches the provider's specification precisely, including required field delimiters
Requested scope too narrowToken obtained successfully but SMTP-specific operations are rejectedConfirm the OAuth consent scope explicitly includes SMTP/mail-send permissions, not just general account access
Refresh token revoked or expiredPreviously working integration stops working after an extended period of inactivitySome providers expire refresh tokens after prolonged inactivity or a security event — re-run the full authorization flow to obtain a fresh one
Service account delegation not properly configuredServer-side sending fails despite correct credentials elsewhereConfirm domain-wide delegation (or equivalent) is explicitly granted to the service account by an administrator, a step separate from basic OAuth app registration

SMTP Authentication in Automated and Programmatic Contexts

Applications sending mail programmatically — a web application's transactional email, a monitoring system's alert notifications, a scheduled batch job's report emails — face authentication considerations somewhat different from an interactive human using a mail client. There's no user present to respond to a re-authentication prompt, no one to notice a silently expiring credential until mail simply stops sending, and often significantly higher connection volume than a single person's mail client would ever generate. This is precisely why dedicated transactional email providers have become the standard approach for anything beyond very low-volume automated sending: they typically offer simplified, purpose-built SMTP credentials (often API-key-style tokens used as the password field) designed specifically for unattended, high-volume use, with built-in monitoring, delivery tracking, and often more generous sending limits than a personal or even standard business mailbox account. Attempting to route high-volume automated mail through a personal Gmail or Outlook account's SMTP credentials, by contrast, frequently runs into sending limits, additional security friction (unusual activity flags, CAPTCHA challenges), or outright account suspension, since these consumer-oriented services aren't designed or intended for that usage pattern.

Diagnosing Authentication Issues: A Systematic Approach

When SMTP authentication fails and the cause isn't immediately obvious, working through a consistent sequence saves considerable time compared to guessing randomly at fixes. First, confirm the connection itself succeeds and TLS negotiates properly — an authentication failure downstream of a TLS problem will often produce a confusing error that looks credential-related but isn't. Second, check the server's EHLO response to see exactly which AUTH mechanisms it actually advertises, confirming the client is attempting one that's genuinely supported rather than assuming compatibility. Third, verify the credentials themselves are current and correctly entered, accounting for the possibility that an app-specific password or OAuth token — not the main account password — is what's actually required. Fourth, check the account's own status directly through the provider's administrative interface, since a suspended, locked, or policy-restricted account will reject authentication regardless of how correct the credentials and mechanism are. Only after ruling out each of these should you suspect a genuinely unusual cause like a provider-side outage or an undocumented security policy change.

Security Implications of Storing SMTP Credentials

Wherever SMTP credentials are stored — in application configuration, a CI/CD pipeline's secrets, a scheduled task's saved settings — the same general secrets-management principles that apply to any sensitive credential apply here too, and it's worth stating them explicitly in this context specifically because SMTP credentials are so often treated more casually than, say, a database password or API key, despite carrying real risk if leaked (an attacker with valid SMTP credentials can send mail appearing to come from your domain's infrastructure, potentially damaging domain reputation or facilitating further phishing). Avoid committing credentials directly into source control, even in a private repository, since access control and history retention make accidental exposure more likely than it initially appears. Prefer a dedicated secrets manager or environment-variable injection at deploy time over configuration files checked into any repository. Where the mail provider supports it, prefer OAuth tokens with narrowly scoped permissions over long-lived passwords, specifically because a scoped, revocable token limits the blast radius of a leak in a way a full account password simply doesn't.

How Authentication Fits Alongside SPF, DKIM and DMARC

It's worth being explicit that SMTP AUTH and domain-level authentication standards like SPF, DKIM and DMARC solve entirely different problems, even though they're often discussed in the same breath. SMTP AUTH verifies that whoever is connecting to a specific server has valid credentials to send through that server — it's a relationship between a client and the specific server it's talking to. SPF, DKIM and DMARC operate at a completely different layer, verifying (after the fact, from the receiving server's perspective) whether a message's claimed sending domain aligns with who actually sent it, regardless of which server or credentials were used. A message can pass SMTP AUTH perfectly (the sender genuinely had valid credentials for that server) while still failing DMARC (because the From: domain doesn't match what that server is authorized to send for) — these are independent, complementary layers of trust rather than substitutes for one another.

Related Reading

For the port-level distinctions referenced throughout this guide, see SMTP Ports Explained. For the TLS mechanics underpinning secure authentication, read SMTP TLS vs SSL. For broader connection troubleshooting beyond authentication specifically, see SMTP Troubleshooting and SMTP Connection Errors. For relay-specific authentication patterns, read SMTP Relay. To test your own server's connectivity and TLS behavior directly, use the SMTP Tester.

Reviewed by: ToolsNovaHub Editorial Team📅 Last updated: August 2026📜 Sourced from: RFC 4954 (SMTP Service Extension for Authentication) and RFC 5321 (SMTP)

ToolsNovaHub tools are built and independently maintained with a focus on accurate, no-signup network and security utilities. Spotted an error? Let us know.

📋 Related Tools & Guides Comparison

ResourceTypeLink
SMTP TesterToolOpen Tool →
MX LookupToolOpen Tool →
DKIM LookupToolOpen Tool →
SMTP Ports ExplainedGuideRead Guide →
SMTP TLS vs SSLGuideRead Guide →
SMTP TroubleshootingGuideRead Guide →
SMTP Connection ErrorsGuideRead Guide →

Frequently Asked Questions

No — the original SMTP specification (from the early 1980s) has no concept of a login at all. Authentication was added later through the SMTP AUTH extension (RFC 4954), which is why not every SMTP server or connection uses it, and why plain relay-only servers can exist with no authentication whatsoever.
Both transmit a username and password, base64-encoded rather than encrypted on their own. AUTH LOGIN sends the username and password as two separate exchanges; AUTH PLAIN sends them together in a single combined string. Neither is more secure than the other on its own — both rely entirely on the surrounding TLS connection for actual protection.
No, and this is a critical distinction. Base64 is a reversible encoding scheme, not encryption — anyone who intercepts an unencrypted SMTP AUTH exchange can trivially decode the base64 and read the credentials in plain text. This is exactly why SMTP AUTH should never be used without TLS already in place.
Some providers restrict AUTH LOGIN/PLAIN with a bare username and password specifically because it's considered a weaker authentication method compared to modern alternatives like OAuth, and require users to explicitly opt into allowing it, or generate an app-specific password instead of using their main account password directly.
OAuth (specifically XOAUTH2 in the SMTP context) authenticates using a short-lived, revocable access token obtained through a separate authorization flow, rather than transmitting a long-lived password directly on every connection. If a token is compromised, it can be revoked without changing the underlying account password, and tokens typically expire automatically.
Technically yes if a server allows it, but it means the username and password are transmitted in a form that's trivially reversible to anyone monitoring the connection. Any competently configured mail server today should refuse to offer or accept AUTH LOGIN/PLAIN over an unencrypted connection.
A 535 response code specifically indicates the server rejected the provided credentials — this is different from a connection-level failure and means the server is reachable and working, but the username, password, or authentication method itself wasn't accepted.
Common causes include the account requiring an app-specific password instead of the main account password, two-factor authentication being enabled without a corresponding app password generated, the account being locked or suspended, or the client attempting an authentication mechanism the server doesn't support.
Not necessarily — authentication is specifically required when a client is submitting mail through a server on behalf of a user (port 587/465 submission), but server-to-server relay on port 25 traditionally doesn't use SMTP AUTH at all, relying instead on other trust mechanisms like IP allowlisting or SPF, a distinction that trips up a lot of people comparing the two contexts directly.
Relay authentication is typically enforced through allowlisted sending IP addresses or dedicated relay credentials configured server-side, rather than the interactive username/password AUTH exchange a mail client uses — the underlying goal (proving you're authorized to send) is the same, but the mechanism differs.
Yes — command-line tools like swaks or a manually typed AUTH exchange through openssl s_client (after establishing a TLS connection) let you test authentication directly, which is useful for isolating whether a failure is connection-related or credential-related.
It exists as an older mechanism and is occasionally still supported for backward compatibility, but it's largely fallen out of favor since it doesn't integrate well with modern TLS-based security models and offers no meaningful advantage over simply using AUTH LOGIN/PLAIN over TLS or, better, OAuth-based authentication.
To support a range of client capabilities — older or simpler clients may only support AUTH PLAIN, while others support OAuth-based mechanisms; advertising several lets the server accommodate whichever mechanism a connecting client actually implements.
The server responds with an error indicating the mechanism isn't available, rather than silently failing — checking the EHLO response's advertised AUTH mechanisms first tells you exactly which ones are actually usable before attempting one that isn't supported.
Generally not recommended — hardcoded credentials are a common source of accidental credential leaks (through source control, logs, or error messages) and don't support easy rotation; using environment variables, a secrets manager, or OAuth tokens with limited scope is considered better practice.
Not directly — SMTP AUTH verifies that whoever is connecting has valid credentials to send through that specific server, but doesn't itself verify the From: address claimed in a message matches the authenticated account, which is a separate concern addressed by SPF, DKIM and DMARC.
Application servers sending transactional or bulk mail typically use dedicated, purpose-specific SMTP credentials (often through a transactional email provider) rather than a personal mailbox account, since personal accounts usually have sending limits and aren't designed for automated, high-volume use.
Confirm you're connecting over an encrypted connection first (TLS via STARTTLS or implicit TLS), check the server's advertised AUTH mechanisms in its EHLO response, and confirm your credentials are correct for that specific mechanism — our SMTP Tester tool generates the exact commands to verify the connection and TLS layer before you attempt authentication on top of it.