# Apex WPForms Mail Fix (Post-Outage)

When Apex Track Experience form notifications (register/waiver) stop sending, follow this checklist:

## 1. Check Debug Events

```sql
SELECT id, subject, status, date_sent, error_text
FROM wp_wpmailsmtp_debug_events
ORDER BY id DESC LIMIT 10;
```

## 2. Check SMTP Password Serialization

The WP Mail SMTP plugin stores passwords in PHP serialized format in wp_options:

```sql
SELECT option_value FROM wp_options WHERE option_name = 'wp_mail_smtp';
```

Look for: `s:72:"apex.track!!"` - the length prefix (72) must match actual password length (13).

**Fix:**
```sql
UPDATE wp_options
SET option_value = REPLACE(option_value,
    's:72:\\"apex.track!!\\"',
    's:13:\\"apex.track!!\\"')
WHERE option_name = 'wp_mail_smtp';
```

## 3. Check Form Sender Address

WPForms notification sender_address should be a single email, not comma-separated.

```sql
SELECT ID, JSON_EXTRACT(post_content, '$.settings.notifications."1".sender_address') as sender
FROM wp_posts WHERE ID IN (270, 268) AND post_type = 'wpforms';
```

**Fix:**
```sql
UPDATE wp_posts SET post_content = REPLACE(
    post_content,
    'contact@apextrackexperience.com, g@germainebrown.com',
    'contact@apextrackexperience.com'
) WHERE ID IN (270, 268);
```

## 4. Re-send Missed Notifications

```sql
SELECT entry_id, form_id, fields FROM wp_wpforms_entries
WHERE DATE(date) = CURDATE() AND form_id IN (268, 270, 272);
```

Re-send via SMTP Python script using the Apex SMTP server at c1113726.sgvps.net:2525.

## 5. Verify SMTP Connectivity

Test from the server:
```python
import smtplib, ssl
ctx = ssl.create_default_context()
with smtplib.SMTP('c1113726.sgvps.net', 2525, timeout=15) as s:
    s.starttls(context=ctx)
    s.login('contact@apextrackexperience.com', 'apex.track!!')
    print('OK')
```
