# SMTP & PHP Mail Issues — Pending Resolution

## Summary

Last session (2026-07-24/25) uncovered fundamental issues with WordPress email delivery after the Brevo → self-hosted migration. Steve is not confident in the current PHP mail-only approach and wants a proper primary SMTP + PHP fallback setup before declaring this fixed to customers.

## Current State

Component Status Detail
———–——–——–
Postfix ✅ Running Direct MX delivery, IPv4-only (`inet_protocols=ipv4`) pending IPv6 PTR propagation
DKIM signing ✅ Fixed OpenDKIM TrustedHosts updated — now signs pickup (PHP mail) mail
WordPress outbound ⚠️ PHP mail only All 23 sites use `wp_mail()` → PHP `mail()` → Postfix sendmail
FluentSMTP ⚠️ Default only Configured to “Default (PHP mail)” — no secondary transport
SMTP auth ❌ Broken FluentSMTP insists on authentication even with `auth: false` to localhost:25

## Issues Discovered

### 1. Divi Contact Form Helper hijacks phpmailer_init

Root cause: DCFH plugin has built-in `SMTPManager` class that hooks `phpmailer_init` at priority 11 — this runs AFTER FluentSMTP and forces SMTP to `uk6.wpx.net` (a dead WPX Hosting relay).

Fix applied: Deactivated DCFH plugin on touchwell.co.uk. PHP mail delivery restored.

Affected sites: Any site using Divi Contact Form Helper. Need to audit all.

### 2. FluentSMTP refuses localhost SMTP without auth

Attempted: Configure FluentSMTP as primary transport with `smtp_host: localhost`, `smtp_port: 25`, `auth: false`.

Result: FluentSMTP still attempts authentication and fails. Unknown why — needs investigation.

### 3. “Unknown” connection artifact in FluentSMTP UI

A stale serialized entry in `fluentmail_connections` options table showed “Unknown” as a second connection. This was a corrupted artifact from earlier shell-based edits to the serialized data. Cleaned up — database now has only one connection.

### 4. Steve's Requirements

“Email from WP Forms is notoriously difficult, plugins are used to allow multiple methods for sending to ensure delivery. Historically I have used PHP as a fallback method and SMTP as primary.”

Architecture Steve wants:

``` WordPress → FluentSMTP → SMTP primary → Postfix → direct MX

                     → PHP mail() fallback

```

Current architecture (not acceptable):

``` WordPress → wp_mail() → PHP mail() → Postfix → direct MX ```

## Key Session Quotes

Steve (2026-07-24, ~03:45):

“I think this is a risky setup. Email from WP Forms is notoriously difficult, plugins are used to allow multiple methods for sending to ensure delivery. I'm hesitant to tell the customer that this is fixed when it could blow up in his face, and mine.”
“Customers are very reliant on their forms and almost require a guaranteed, failsafe delivery, we are not there.”

Gwen (2026-07-24, ~03:46):

“You're right to be cautious. What's fixed: DCFH plugin was hijacking phpmailer_init. PHP mail delivers. What's not right: PHP mail alone is a single point of failure. You want primary SMTP + PHP mail fallback. I tried SMTP to localhost:25 and FluentSMTP insisted on authenticating even with auth: false — I don't know why yet.”

## Open Questions

1. Why does FluentSMTP require authentication even with `auth: false` and `smtp_host: localhost`? 2. Can we configure Postfix to accept unauthenticated SMTP from localhost on port 587? 3. Should we use a different SMTP plugin instead of FluentSMTP? 4. Should we configure Postfix `mynetworks` to trust 127.0.0.1 for relay without auth? 5. Does Postfix currently allow unauthenticated relay from localhost?

## Next Steps (Steve to review)

- [ ] Verify Postfix accepts unauthenticated SMTP on localhost:25 - [ ] Test `swaks` from kaburusvr to verify SMTP delivery without auth - [ ] If Postfix rejects localhost SMTP, add `127.0.0.1` to `mynetworks` in main.cf - [ ] Investigate FluentSMTP auth behavior — is it a bug or config issue? - [ ] Consider testing Post SMTP or WP Mail SMTP as alternatives - [ ] Once SMTP works, set it as primary with PHP mail fallback in FluentSMTP - [ ] Test end-to-end: form submission → SMTP primary → Postfix → Gmail delivery

## Related Pages

- email-configuration — Full email setup reference - kaburusvr — Server details - wordpress-sites — All 23 client sites

## Session Reference

- Session ID: `20260723_191500_4c5fa064` (Telegram, Jul 23-25 2026) - Contains: Full touchwell email debugging, DCFH discovery, FluentSMTP configuration, Steve's requirements discussion