WordPress Email Not Sending on Hetzner: Fixes That Work

WordPress Email Not Sending on Hetzner: Fixes That Work

WordPress not sending email on Hetzner usually comes down to one thing: the site is handing mail to the server's local mail path, and Hetzner restricts that route. Hetzner Cloud blocks outbound ports 25 and 465 by default on all cloud servers. Hetzner itself confirms that only port 587 remains open by default for mail server traffic. The practical fix is to send through authenticated SMTP on port 587, either via a Hetzner web hosting mailbox or a transactional provider, and to send from a verified address on your own domain.

Confirm the Failure Before Changing Settings

Before touching any configuration, establish that email is actually leaving WordPress and where it stops. Lost contact form messages, silent password reset failures, and missing order confirmations can have different causes.

Check the Server Mail Log

Log in to your Hetzner server and inspect the local mail log, typically at /var/log/mail.log on Debian or Ubuntu systems. A blocked outbound port produces a connection timeout with no reply, while other mail failures return numbered responses. If you see repeated timeout entries when WordPress tries to send, the port block is likely the culprit.

You can also test port reachability directly from inside the server or container using nc, which distinguishes a blocked port from other failures. Run the test from the server itself, not your local machine, because the relevant firewall surrounds the server.

Distinguish Timeouts from Error Codes

The error you see points to the cause. A timeout with no SMTP reply means packets are being dropped before they reach a mail server. A numbered reply such as 535 5.7.8 means the connection succeeded but the credentials were refused. If messages send without error but never arrive, the problem sits downstream at the receiving provider or in spam filtering, not in the outbound path.

Why Hetzner Blocks the Default WordPress Mail Path

WordPress uses PHP's mail() function by default, which hands messages to the server's local mail transfer agent. That agent typically tries to relay directly to recipient servers on port 25, which is the default port for server-to-server mail relay.

Hetzner Cloud blocks that path for a stated reason: spammers and scammers like to use cloud hosting providers. Hetzner's documentation also notes that many ISPs and networks block or monitor port 25 to prevent spam and misuse. The block is not specific to WordPress, but WordPress is one of the most common ways site owners encounter it.

The practical consequences are straightforward:

  • Mail sent through the local mail() path on port 25 will time out on Hetzner Cloud.
  • Hetzner does not offer an SMTP server with its Cloud Server package, so there is no built-in relay to fall back on.
  • By default, Hetzner allows script connections only on port 587.

Hetzner's guidance for script-sent mail is explicit: emails from website scripts such as WordPress can only be transferred to external servers via port 587, otherwise the local MTA can be used. Since the local MTA path is what gets blocked, the useful option is port 587.

Option A: Send Through a Hetzner Mailbox

If you already have a Hetzner web hosting package with a mailbox, you can use it as your SMTP relay. Hetzner web hosting customers can use a mailbox on their hosting package for sending mail. This keeps everything within Hetzner and avoids a separate provider.

SMTP Settings to Use

For Hetzner web hosting mailboxes, the outgoing SMTP server is mail.your-server.de. Use these settings, per Hetzner's email account configuration documentation:

Setting Value
SMTP host mail.your-server.de
Port 587 (recommended)
Encryption STARTTLS
Authentication Username and password of the mailbox

Hetzner recommends port 587 for sending mail from email clients and notes it usually requires authentication. Port 587 is the official port for client-to-server communication, and Hetzner's documentation recommends using it for mail from email clients. Because it is intended for authenticated SMTP transmissions, it usually requires a username and password.

Configure an SMTP Plugin in WordPress

The supplied sources do not document specific plugin screens, but the general steps are consistent across SMTP plugins:

  1. Install an SMTP plugin from the WordPress plugin directory.
  2. Enter the SMTP host, port, encryption, username, and password from the table above.
  3. Set the From address to a mailbox address on your own domain.
  4. Send a test email from the plugin's settings page and check that it arrives.

Keep the mailbox credentials in the plugin settings rather than hardcoding them in theme files, so you can update them without editing code.

Option B: Use a Transactional Email Provider

A Hetzner mailbox works for low-volume site mail, but a dedicated transactional provider is often the better fit when deliverability, volume, or logging matter.

Transactional email providers offer HTTP APIs over port 443, which hosts do not block. That makes the API route a reliable fallback when SMTP itself is restricted anywhere in the chain. Many providers also offer SMTP relays on port 587, which fits Hetzner's open port.

Choose a transactional provider when:

  • You send order confirmations, password resets, or other time-sensitive mail at volume.
  • You need delivery logs and bounce handling in one dashboard.
  • You want to avoid managing a mailbox solely for site mail.

A Hetzner mailbox remains the simpler choice if you already pay for web hosting with mail included and your sending volume is modest.

Set the Sender Address and Headers Correctly

The From address matters as much as the SMTP path. Sending from a generic server address such as wordpress@yourserver damages trust and can land messages in spam.

Hetzner warns that incorrectly set headers in script-sent mail can make messages look like spam. That warning applies even when the SMTP connection succeeds: the message leaves the server but the receiving provider rejects or filters it.

Use a Domain Address, Not the Server Default

Set the From address to a real mailbox on your own domain, such as noreply@yourdomain.com, and make sure that mailbox exists or forwards somewhere monitored. If you use PHP's mail() function, Hetzner advises paying special attention to the envelope-from parameter. With an SMTP plugin, the plugin typically handles the envelope for you, but check that the From address and the authenticated mailbox align.

Align the Envelope Sender with the from Address

The envelope sender is the address a receiving server checks during the SMTP conversation. If it differs from the visible From address and neither is authorized for your domain, authentication checks can fail. Keep the authenticated mailbox, the envelope sender, and the From address on the same domain so receiving providers see a consistent identity.

Troubleshoot Port, Encryption, and Credential Errors

Most remaining failures after SMTP configuration come from a small set of mismatches.

Port and Encryption Mismatch

Port 587 pairs with STARTTLS, not implicit TLS. When moving a relay to port 587, the client should use STARTTLS rather than implicit TLS. Some third-party guides list port 465 with SSL as an option for Hetzner, but Hetzner's own documentation lists port 465 with SSL for outgoing SMTP as outdated. Hetzner describes port 465 as obsolete as a standard and recommends port 587 instead. Use 587 with STARTTLS unless you have a specific reason to do otherwise.

Credential Errors

A 535 5.7.8 reply means the connection succeeded but the credentials were refused. Check for typos in the username, a password that was changed in the Hetzner panel but not in the plugin, or a mailbox that has been disabled. Re-enter the credentials in the plugin settings rather than relying on a cached value.

Plugin Conflicts

If test emails fail while direct SMTP tests from the server succeed, another plugin may be intercepting wp_mail(). Deactivate other mail-related plugins one at a time to isolate the conflict, then reactivate them once the working configuration is confirmed.

Request a Port Unblock Only When You Need It

If you plan to run your own mail server on the Hetzner Cloud instance, you need port 25 unblocked. Hetzner Cloud users who need port 25 for running their own mail server must request an unblock. Hetzner Cloud customers can request a port unblock after one month and a paid first invoice, decided case by case. The limit request option appears in the project overview under Limits.

For a WordPress site sending through an SMTP relay, you do not need this request. Port 587 is not blocked on Hetzner Cloud and can be used without a limit request. Requesting an unblock adds approval time and review that a standard WordPress setup does not require.

Verify Delivery End to End

After configuration, confirm the whole path works rather than assuming it does.

  1. Send a test email from your SMTP plugin to an address at a major provider such as Gmail or Outlook.
  2. Check that the message arrives in the inbox, not spam, and inspect the headers to confirm SPF and DKIM results.
  3. Trigger a real WordPress email, such as a password reset, and confirm delivery.
  4. Watch the server mail log during the send for any remaining timeout or rejection entries.

If mail sends but lands in spam, revisit the sender address and header configuration. If mail times out again, re-check that the plugin is actually using port 587 and not falling back to the local mail() path. If credentials are refused, re-enter the mailbox password.

What to Expect After the Fix

With authenticated SMTP on port 587 and a sender address on your own domain, WordPress mail should leave the Hetzner server reliably. Keep the SMTP plugin configured rather than reverting to the default mail() path, since the default is what Hetzner restricts. If you later add a transactional provider, the same port 587 and sender-alignment rules apply, and its HTTP API on port 443 offers a further fallback.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top