SMTP failures often look alike in application logs: a timeout, a vague “connection failed” message, or a 535 authentication error. To troubleshoot SMTP connection issues quickly, separate the problem into stages—DNS resolution, TCP connectivity, TLS negotiation, SMTP authentication, message submission, and downstream delivery—and test each stage independently.

This guide is vendor-neutral. Whether your application sends through a cloud email platform, an internal relay, a mailbox provider, or a self-hosted MTA, the same SMTP conversation and network fundamentals apply. The goal is not to keep changing settings until something works. It is to identify the exact point at which the exchange stops, collect evidence, and make the smallest safe correction.

Start by identifying the failing stage

“SMTP connection issue” is an overloaded phrase. A message may fail before your code reaches the SMTP server, while negotiating encryption, when authenticating, or after the provider has accepted the message. Those are different failures with different owners and fixes.

A normal authenticated submission session generally looks like this:

1. Resolve smtp.example-provider.com to an IP address
2. Open a TCP connection to the chosen port
3. Receive the server greeting: 220 ...
4. Send EHLO and receive advertised capabilities: 250-...
5. Negotiate TLS, if required
6. Send EHLO again after TLS
7. Authenticate with AUTH
8. Submit MAIL FROM, RCPT TO, and DATA
9. Receive a queue or acceptance response, commonly 250

The SMTP specification defines the basic command flow and reply-code families. In practice, the first digit is the most useful clue: 2xx means success, 4xx means a temporary failure, and 5xx means a permanent failure for the current request. A 250 after DATA means the receiving submission service accepted the message for processing; it does not prove inbox delivery.

Use this triage table before changing anything:

SymptomMost likely stageTypical causes
getaddrinfo ENOTFOUND, no such host, DNS timeoutDNSMisspelled hostname, broken resolver, private DNS issue
ECONNREFUSED, Connection refusedTCPWrong port, service not listening, firewall rejection
ETIMEDOUT, Connection timed outTCP/networkEgress firewall, cloud provider port block, routing issue
wrong version number, handshake alert, certificate errorTLSSTARTTLS/implicit TLS mismatch, bad CA chain, hostname mismatch
535, 5.7.8, authentication failedSMTP AUTHWrong credentials, expired key, unsupported auth method
530 Must issue STARTTLS firstSMTP protocol/TLSClient attempted AUTH before upgrading to TLS
550, 553, sender not allowedSubmission policyUnverified sender/domain, account or relay restriction
250 queued but recipient never sees mailDelivery, not connectionSpam filtering, authentication alignment, suppression, recipient policy

Treat the exact error text, timestamp, host, port, and network location as evidence. “Works on my laptop but not in production” is especially valuable: it usually points to an outbound firewall, a container-network policy, a different DNS resolver, or missing production secrets—not to the SMTP provider.

Confirm the SMTP host, port, and encryption mode

The most common configuration problem is a mismatch between a port and the client’s TLS mode. SMTP submission commonly uses either port 587 with STARTTLS or port 465 with TLS active immediately when the TCP connection opens. These modes are not interchangeable.

STARTTLS on port 587

With STARTTLS, the client begins with plaintext SMTP, sends EHLO, confirms that the server advertises STARTTLS, sends the STARTTLS command, then begins a TLS handshake. After the handshake, it sends EHLO again because the server’s advertised capabilities may change under TLS.

A conceptual session looks like this:

S: 220 smtp.example.net ESMTP ready
C: EHLO app.example.com
S: 250-smtp.example.net
S: 250-STARTTLS
S: 250-AUTH PLAIN LOGIN
S: 250 SIZE 52428800
C: STARTTLS
S: 220 Ready to start TLS
--- TLS handshake happens here ---
C: EHLO app.example.com
S: 250-AUTH PLAIN LOGIN

If an application is configured for “SSL/TLS from connection start” while pointing to a STARTTLS endpoint, it may produce an error such as wrong version number, unknown protocol, or an immediate disconnect. The client sent TLS bytes when the server expected an SMTP EHLO command.

Implicit TLS on port 465

On port 465, the TLS handshake happens before any readable SMTP greeting. The client should not issue STARTTLS after connecting because the connection is already encrypted.

If you configure a STARTTLS client for an implicit-TLS endpoint, it waits for a plaintext SMTP banner that never arrives. The result can be a timeout, handshake failure, or unreadable protocol response.

Do not assume port 25 is submission

Port 25 is primarily used for server-to-server mail transfer. Some providers accept authenticated submission there, but many networks restrict outbound port 25 to reduce abuse. Use the provider’s documented submission endpoint and recommended port instead of guessing. For application-originated email, 587 with STARTTLS is usually the least surprising choice when supported.

Before rotating credentials or editing DNS, write down these four settings exactly as they appear in your provider documentation:

  1. SMTP hostname, such as smtp.provider.example.
  2. Port, commonly 587 or 465.
  3. Encryption mode: STARTTLS, implicit TLS, or an explicitly documented alternative.
  4. Authentication method and credential format.

Do not use http:// or https:// in the SMTP hostname field. Do not paste a full API URL into an SMTP host setting. SMTP relay hostnames and REST API base URLs are often different.

Test DNS resolution from the machine that sends mail

A hostname that resolves from your workstation may fail from a production container, serverless runtime, private subnet, or on-premises network. Always run the first test from the same network environment that produces the error.

On macOS or Linux, query the configured resolver:

dig +short smtp.example-provider.com

On Windows PowerShell:

Resolve-DnsName smtp.example-provider.com

A successful answer should return one or more IP addresses or a CNAME chain that ultimately resolves to IP addresses. If it returns nothing, times out, or responds with NXDOMAIN, first verify the hostname character for character. A trailing typo in a copied environment variable is more common than a global DNS outage.

Check environment variables and configuration precedence

Many frameworks load SMTP settings from several locations: a local .env file, deployment secrets, application configuration, platform variables, and code defaults. The value your code prints at runtime is more important than the value you edited locally.

Inspect safely. Log the hostname, port, TLS mode, and username length, but never log the password, API key, or full authorization header. A useful startup diagnostic might look like this:

SMTP host=smtp.example-provider.com port=587 secure=false starttls=true username_present=true

The exact property names vary by library. In many Node.js mail libraries, secure: false with port 587 means the connection starts in plaintext and upgrades through STARTTLS, while secure: true is used for implicit TLS on port 465. Verify the semantics in your library’s documentation rather than treating the word “secure” as universal.

Understand which DNS records matter now

Your SMTP relay hostname must resolve for a connection to start. Sender-domain records such as SPF, DKIM, and DMARC usually do not prevent the initial connection to a provider relay, but they can affect whether messages are later accepted, filtered, quarantined, or rejected by recipient systems.

For example, an SPF TXT record may look like this:

example.com. 3600 IN TXT "v=spf1 include:spf.email-provider.example -all"

That is illustrative only: use the include domain supplied by your actual sender. SPF authorizes hosts for the envelope sender domain; it is not a record that tells your application where to connect. SPF is published as a DNS TXT record, and a domain must avoid publishing multiple independent SPF records at the same name because that can produce a permanent SPF error.

Use dig TXT example.com or Resolve-DnsName example.com -Type TXT to inspect published text records. Tools such as MXToolbox can additionally test SMTP reachability, reverse DNS, and basic relay behavior from an external vantage point.

Prove TCP reachability before debugging SMTP

DNS success tells you only that a name resolves. It does not prove that the application host can open a network connection to the destination and port.

From Linux or macOS, test a TCP socket with Netcat:

nc -vz smtp.example-provider.com 587

From Windows PowerShell:

Test-NetConnection smtp.example-provider.com -Port 587

A successful TCP test usually reports succeeded, open, or TcpTestSucceeded : True. A failure is still useful because it narrows the problem substantially.

Read common network errors correctly

Connection refused means the destination IP actively rejected the connection. This often indicates a wrong port, an endpoint that is not listening, or a firewall configured to reject rather than silently drop traffic.

Connection timed out means no usable response arrived before the client deadline. Common causes include an outbound security group, network firewall, proxy rule, ISP restriction, private-network route, or a destination-side outage. Timeouts can also occur when an IPv6 address is selected but your environment has incomplete IPv6 routing.

Network is unreachable or no route to host is local networking. Check subnet routes, NAT gateway configuration, VPN state, and whether a workload in a private subnet has permitted internet egress.

Connection reset by peer means a connection was established and then closed forcefully. It can be caused by protocol mismatch, an intermediary firewall, an IP reputation policy, connection-rate limiting, or a service that does not accept traffic from your source.

Check cloud and corporate egress controls

Production networks commonly allow HTTPS on 443 but deny SMTP ports. This is deliberate in many hosting environments because unrestricted SMTP egress can be abused. The relevant control may live in a cloud security group, network ACL, NAT firewall, Kubernetes NetworkPolicy, container-host firewall, corporate proxy, or email-security appliance.

Ask the network owner a precise question: “Can this workload’s source IP or subnet establish outbound TCP connections to smtp.example-provider.com on port 587?” That question is much more actionable than “SMTP is broken.”

If TCP access is blocked and your email provider offers both SMTP relay and a REST sending API, testing the API over HTTPS can help isolate the issue. If the API works but SMTP on 587 times out from the same workload, the likely cause is outbound SMTP filtering rather than sender identity or message content. For implementation options and request formats, consult the provider’s email API reference and setup guides.

Validate TLS with OpenSSL

Once TCP is reachable, use OpenSSL to see whether the server presents a valid certificate, supports the expected TLS mode, and advertises the protocol features your application needs. This removes your application framework from the experiment.

For STARTTLS on port 587:

openssl s_client -starttls smtp \
  -connect smtp.example-provider.com:587 \
  -servername smtp.example-provider.com \
  -crlf

For implicit TLS on port 465:

openssl s_client \
  -connect smtp.example-provider.com:465 \
  -servername smtp.example-provider.com \
  -crlf

The -starttls smtp option makes OpenSSL perform the SMTP upgrade sequence before beginning TLS. The -servername value enables SNI, which is important when a provider uses one IP address for multiple TLS hostnames.

What a healthy TLS test looks like

Look for all of the following:

  • A successful connection rather than a timeout.
  • A certificate chain that terminates in a trusted certificate authority.
  • A certificate subject alternative name that covers the hostname you connected to.
  • A modern negotiated TLS protocol and cipher suite.
  • Verify return code: 0 (ok) when your system trust store recognizes the chain.
  • An SMTP greeting and an EHLO response after the handshake.

After OpenSSL connects, type:

EHLO debug.example.com

The server should return one or more 250- lines. Look for advertised extensions such as AUTH, SIZE, PIPELINING, and, before a STARTTLS upgrade, STARTTLS. SMTP’s TLS extension specifies that clients must discard knowledge gained before TLS and issue EHLO again after the handshake.

Common TLS failures and their meaning

certificate verify failed often means an outdated CA bundle, TLS inspection proxy, incomplete certificate chain, or a server certificate that does not match the hostname. Do not solve this permanently by disabling certificate validation. That converts a diagnosable configuration problem into a security weakness that can expose credentials and message content.

hostname mismatch usually means the configured SMTP host is not the hostname covered by the certificate. Use the exact relay hostname documented by the provider, not a guessed alias, an IP address, or a web-dashboard domain.

unsupported protocol or no shared cipher may indicate an old runtime with outdated TLS support. Update the operating system, language runtime, OpenSSL package, or HTTP/SMTP library as appropriate. Avoid forcing obsolete protocols merely to restore connectivity.

A TLS error can be caused by a corporate proxy performing TLS interception. The proxy may substitute a certificate signed by an internal CA that your developer laptop trusts but your container image does not. Compare the certificate issuer from a working and failing environment to confirm that possibility.

Inspect EHLO capabilities and SMTP authentication

After the server greets the client and TLS is established, authentication is the next common failure point. SMTP AUTH is an extension to SMTP, and the server advertises the mechanisms it accepts in the EHLO capability response.

A capability line might look like this:

250-AUTH PLAIN LOGIN

That means the server permits the PLAIN and LOGIN SASL authentication mechanisms. It does not mean any username and password will be accepted.

Diagnose 535 and related authentication responses

A response such as these indicates an authentication or authorization problem:

535 5.7.8 Authentication credentials invalid
534 5.7.9 Application-specific password required
530 5.7.0 Must issue a STARTTLS command first
454 4.7.0 Temporary authentication failure

535 is usually permanent until you change a credential, enable the correct account permission, or use the required credential format. Check whether the SMTP username is a literal username, an email address, a fixed value, or an API-key identifier. Many services use an API key as the SMTP password, but the username convention is provider-specific.

534 often means a mailbox provider will not accept the account’s normal web-login password for SMTP. It may require an app password, OAuth-based flow, or a relay configuration approved by the account administrator.

530 means your client tried to authenticate before TLS. Configure STARTTLS when using the submission endpoint that requires it, and ensure your client does not disable TLS upgrade support.

454 belongs to the temporary-failure family. Retry with exponential backoff, but do not retry tightly or indefinitely. Record the full enhanced status code and message because a provider may use 4.7.x for temporary authentication, rate, policy, or security conditions.

Avoid manual AUTH tests with real production credentials

You can manually speak SMTP after an OpenSSL connection, but avoid placing production credentials in shell history, terminal recordings, screen shares, CI logs, or support tickets. A safer sequence is to test the handshake and EHLO manually, then use a one-time restricted credential in the application or an approved SMTP test tool.

If you must rotate a credential during investigation, update it atomically. Deploy the new secret first, verify healthy sends, then revoke the old one. Rotating the secret before all workers, scheduled jobs, and deployment environments have the new value can turn a localized incident into a full outage.

Check sender authorization and message-envelope settings

A successful AUTH response does not guarantee permission to use every sender address. Providers and relays may restrict the From header, SMTP envelope sender (MAIL FROM), sending domain, IP address, tenant, or recipient domain.

This stage often produces errors such as:

550 5.7.1 Sender address not allowed
553 5.7.1 Sender address rejected
554 5.7.1 Message rejected due to policy

These are not connection failures. Your client has connected and spoken SMTP successfully. The service is applying a sender or content policy.

Keep the visible From address and envelope sender intentional

The visible header sender is what recipients see:

From: Billing <billing@example.com>

The envelope sender is passed in the SMTP transaction:

MAIL FROM:<bounces@example.com>

They can differ, but doing so affects SPF evaluation, bounce handling, and DMARC alignment. A transactional sending platform may use a provider-managed return-path domain unless you configure a custom one. That can be normal; it should still be understood and verified rather than assumed.

Check that the domain in your From address is verified with the service that submits mail. If you changed DNS recently, confirm the record is visible from public resolvers and wait for the TTL to expire. DNS changes are not always instant, and an old cached record can make one environment appear healthy while another fails.

SPF, DKIM, and DMARC are delivery controls, not TCP fixes

SPF, DKIM, and DMARC are frequently blamed for “SMTP failure,” but their usual effect comes after connection and message submission. They determine how recipient systems evaluate sender identity.

An example DKIM record has a selector-specific name and a public key value:

selector1._domainkey.example.com. 3600 IN TXT "v=DKIM1; k=rsa; p=MIIBIjANBgkq..."

An example DMARC record looks like:

_dmarc.example.com. 3600 IN TXT "v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com"

Do not copy these values verbatim. DKIM selectors, key material, reporting addresses, and policy decisions must match your own domain and sending service. Start DMARC policy changes cautiously, evaluate aggregate reports, and ensure SPF or DKIM aligns with the domain used in the visible From header before moving to stricter enforcement.

Send a test message to a mailbox you control and inspect the raw headers. Look for Authentication-Results lines that show SPF, DKIM, and DMARC outcomes. Mail-tester.com can also accept a test message and report on message structure, authentication, server configuration, and other deliverability signals.

Interpret SMTP and application errors without guessing

Your application library may wrap server replies in its own error class. Preserve the underlying SMTP response whenever possible. A log entry containing only “email failed” makes an otherwise quick diagnosis unnecessarily expensive.

Capture these fields in structured logs:

  • SMTP host and port, excluding secrets.
  • Whether TLS was required, negotiated, and verified.
  • Remote IP address when available.
  • SMTP command or pipeline stage that failed.
  • Numeric SMTP response, enhanced status code, and server text.
  • Connection and total-send duration.
  • A non-sensitive correlation ID or message ID.
  • Deployment version, region, and runtime environment.

Reply-code families and retry policy

The reply code family gives a first-pass retry decision:

Reply familyMeaningPractical action
2xxCommand acceptedContinue, or record provider acceptance
3xxMore information neededFollow the protocol sequence; uncommon in ordinary library use
4xxTemporary failureRetry with backoff and a bounded attempt window
5xxPermanent failureDo not retry unchanged input; correct the configuration, sender, recipient, or policy issue

Examples matter. 421 4.7.0 can mean the server is temporarily unavailable or limiting connections. 450 4.2.0 commonly represents a temporary mailbox or queue condition. 451 4.3.0 can indicate transient local processing trouble. 550 5.1.1 is often an invalid recipient, while 550 5.7.1 commonly signals a policy rejection. The human-readable wording differs between providers, so retain both the three-digit code and the enhanced code.

A proper retry system uses exponential backoff with jitter. For example, retry after roughly 1 minute, 5 minutes, 20 minutes, and 60 minutes rather than immediately retrying thousands of messages in parallel. Limit the maximum retry period based on the importance and time sensitivity of the email. A password-reset email should not be delivered hours after the reset token expires.

Compare a minimal test with your application behavior

When the network and relay appear healthy, reduce the sending path to the smallest reproducible test. This distinguishes SMTP problems from template rendering, queue workers, framework middleware, proxies, and application-specific timeouts.

Create a test that sends one small plain-text message with:

  • A verified sender address.
  • One recipient mailbox you control.
  • A simple subject and body.
  • No attachments, inline images, custom headers, or large payload.
  • The same hostname, port, encryption mode, and credentials used in production.

If the minimal test works but production fails, compare the message envelope, source network, concurrency, secret injection, and library versions. Do not assume the SMTP configuration is identical merely because the configuration file is shared.

Check connection pooling and concurrency

Many SMTP libraries reuse connections or open multiple connections in a pool. This improves throughput but introduces failure modes that do not show up in a single-send script:

  • Idle connections may be closed by a load balancer or relay.
  • Too many simultaneous connections can trigger limits.
  • A worker can retain an old credential after a secret rotation.
  • Long-running processes may have stale DNS results.
  • A queue can retry many jobs at once after an outage, creating a self-inflicted rate spike.

Temporarily reduce concurrency to one or two connections and disable pooling if your library supports it. If errors disappear, reintroduce throughput gradually and use provider-specific limits as the ceiling. Keep connection timeout, greeting timeout, socket timeout, and retry policy explicit instead of relying on library defaults.

Watch for message-size and encoding limits

Attachments inflate after Base64 encoding, so a 20 MB file can exceed a 25 MB SMTP message limit once headers and encoding overhead are included. A 552 response may indicate storage allocation or size-related refusal, depending on the server. Check the SIZE capability advertised after EHLO, but remember that every relay in the path may have its own limits.

Malformed line endings, invalid MIME boundaries, bare line feeds, and non-ASCII content without proper encoding can also create failures after the connection succeeds. Libraries normally handle these details; custom raw-message construction needs careful testing.

Rule out local security software, proxies, and clock problems

SMTP troubleshooting is not only about the mail provider. Endpoint protection, local firewalls, transparent proxies, and inaccurate clocks can disrupt a valid SMTP configuration.

Endpoint and proxy interference

Corporate security products may block outbound SMTP, replace certificates, inspect TLS, or allow traffic only through an approved relay. A developer’s laptop may work on a home connection but fail while on a company VPN. A container may fail even though the VM hosting it succeeds because the container network has separate policy controls.

Test from each relevant location:

  1. Your development machine.
  2. The production application host or container.
  3. The queue worker, if it is separate.
  4. The same region and subnet as the failing workload.
  5. An external network test, where appropriate.

Differences between these results are not noise. They map the boundary where the failure begins.

System clock and certificate validation

TLS certificate validation depends on time. A server clock that is far ahead or behind can treat a valid certificate as not yet valid or expired. Confirm that production systems synchronize time through a reliable time service, particularly after restoring old VM snapshots or running isolated infrastructure.

IPv4 and IPv6 differences

If the SMTP hostname returns both A and AAAA records, a runtime may prefer IPv6. A partial IPv6 deployment can lead to intermittent or environment-specific timeouts. Test each address family if your tools allow it, then fix routing rather than permanently pinning an address unless your provider explicitly instructs you to do so.

Hard-coding SMTP IP addresses is usually a bad workaround. It bypasses provider failover, can break certificate hostname verification, and becomes stale when infrastructure changes.

Know when SMTP is healthy but delivery is not

A successful SMTP submission response means your application handed a message to a relay. It does not mean the recipient’s mailbox accepted it, placed it in the inbox, or displayed it promptly.

This distinction prevents a common incident-response mistake: repeatedly changing ports and TLS settings after the relay has already returned 250. At that point, inspect provider event data, bounce information, suppression lists, recipient headers, domain authentication, and the receiving mailbox.

Separate acceptance, delivery, and inbox placement

There are three useful milestones:

  1. Application submission: your code successfully sent the SMTP transaction.
  2. Provider acceptance or handoff: the provider queued or attempted the message.
  3. Recipient outcome: the destination accepted, deferred, rejected, spam-foldered, or otherwise processed it.

A recipient-side 421, 450, or 451 can cause later retries even though your application saw an initial 250 from its relay. A hard bounce or policy rejection may happen after submission. Inbox placement is more variable still and depends on authentication, reputation, content, recipient engagement, and mailbox-provider filtering.

If your provider supports a REST API as well as SMTP relay, use the API as a diagnostic comparison rather than an automatic replacement. Both paths still require legitimate sender identity and healthy deliverability practices, but HTTPS can avoid a network that blocks SMTP submission ports. Choose the interface that fits your application’s operational constraints and observability needs.

Build a repeatable SMTP incident checklist

A documented checklist makes the next incident shorter and prevents risky trial-and-error fixes. Run the steps in order because each one depends on the previous layer working.

  1. Capture the original error. Save the full library error, SMTP reply, timestamp, host, port, environment, and deployment version.
  2. Verify runtime configuration. Confirm the actual hostname, port, TLS mode, username convention, and sender address loaded by the failing process.
  3. Resolve DNS locally. Run dig +short or Resolve-DnsName from the workload environment.
  4. Test the TCP port. Use nc -vz or Test-NetConnection from that same environment.
  5. Test TLS independently. Use openssl s_client -starttls smtp on 587 or direct openssl s_client on 465.
  6. Inspect EHLO capabilities. Confirm the expected STARTTLS and AUTH capabilities appear at the correct stage.
  7. Check credentials and account policy. Use a restricted test credential where possible; confirm it has SMTP permission and was deployed correctly.
  8. Verify sender authorization. Check that the sender domain and envelope sender are approved and that DNS verification records are correct.
  9. Send one minimal message. Remove attachments, templates, batching, and unusual headers.
  10. Compare environments. If one works and another fails, compare egress IPs, firewall policy, resolver behavior, CA bundles, runtime versions, and secret values.
  11. Classify retries correctly. Back off on 4xx; do not hammer 5xx failures with unchanged requests.
  12. Escalate with evidence. Give your provider or network team the timestamp, source IP, destination host and port, OpenSSL output with secrets removed, SMTP response, and a minimal reproduction.

The best support request answers the questions a provider will ask first. It identifies whether the failure happens before TCP, during TLS, at AUTH, at MAIL FROM, at RCPT TO, or after submission. It also proves whether the issue is isolated to one region, account, sender domain, or application version.

Prevent recurring SMTP connection incidents

The strongest troubleshooting practice is reducing the number of production-only surprises.

Keep SMTP settings in managed secrets, not scattered across source files and dashboards. Add a deployment smoke test that verifies DNS resolution, a TLS handshake, and a restricted test send from the target environment. Alert separately on connection failures, authentication failures, deferrals, hard bounces, and delivery latency so that a blocked port is not mixed into the same alert as a bad recipient address.

Document the intended sending architecture: which services submit email, which sender domains they use, which network egress addresses they originate from, and who owns DNS, cloud networking, and provider credentials. This is particularly important when a transactional email platform offers both SMTP relay and REST sending: clear ownership makes it easier to identify whether an incident belongs to the application, network, identity configuration, or recipient-delivery layer.

Finally, test DNS and sender authentication after infrastructure changes. A mail system can appear healthy while a stale SPF include, missing DKIM selector, expired certificate, or changed egress policy slowly degrades delivery. Scheduled checks using public DNS resolvers and a controlled test mailbox provide an early warning before customers notice missing messages.

FAQ

Why does SMTP work locally but time out in production?

The production workload likely has different outbound network rules, DNS resolution, IPv6 routing, proxy behavior, or secrets. Run DNS, TCP, and OpenSSL tests from the production host or container, not from your laptop. A timeout before the SMTP greeting usually points to network reachability rather than credentials.

Should I use port 465 or 587 for SMTP?

Use the port and TLS mode documented by your provider. Port 587 normally uses STARTTLS: connect in plaintext, then upgrade with STARTTLS. Port 465 normally uses implicit TLS: negotiate TLS immediately upon connection. A mismatch between port and mode is a frequent cause of handshake errors.

What does SMTP error 535 mean?

535 generally means the server rejected authentication credentials or the account is not permitted to authenticate in that way. Check the username format, secret, SMTP permission, app-password or OAuth requirement, and whether the client negotiated TLS before attempting AUTH.

Does a 250 SMTP response mean the email reached the inbox?

No. A 250 after message submission normally means the relay accepted the message for processing. The message can still be deferred, bounced, filtered, or sent to spam downstream. Inspect provider delivery events and recipient-side headers to determine the final outcome.

Can SPF, DKIM, or DMARC cause an SMTP connection timeout?

Usually no. DNS authentication records affect sender validation and deliverability after a message is submitted, not the ability to open a TCP connection to an SMTP relay. A timeout is more likely to involve a blocked port, routing issue, firewall, or unreachable endpoint.