--- name: project-tomsjavajive-email description: "Tom's Java Jive email service — CyberMail (CyberPersons), API key stored in config.php" metadata: node_type: memory type: project originSessionId: f0b18417-cc26-4fdf-87ec-7b2d69b02c44 --- ## Email Service: CyberMail by CyberPersons **API Key:** `sk_live_d52bf062797105aeaafac9954c21ff988e9b41b77315807d` **API Key Management:** https://platform.cyberpersons.com/email/api-keys/ **Webmail / Hosting Management:** https://platform.cyberpersons.com/email/webmail/hosting/ **Stored in:** `/home/tomsjavajive.com/public_html/config/config.php` - Constant: `CYBERMAIL_API_KEY` - Replaced the old `SENDGRID_API_KEY` placeholder ## Email Handler - File: `/home/tomsjavajive.com/public_html/includes/email.php` - Class: `SendGridEmail` (still named SendGrid — rename when integrating CyberMail API) - Sends: order confirmation, shipping notification, password reset, welcome, abandoned cart - Currently references `CYBERMAIL_API_KEY` constant (was SENDGRID_API_KEY) ## CyberMail API Reference - **Send:** `POST https://platform.cyberpersons.com/email/v1/send` - **Status:** `GET https://platform.cyberpersons.com/email/v1/messages/{message_id}` - **Account Stats:** `GET https://platform.cyberpersons.com/email/v1/account/stats` - **Auth:** `Authorization: Bearer {api_key}` ## Error Codes | HTTP | error.type | Description | |------|-----------|-------------| | 400 | invalid_request | Missing required fields or invalid email format | | 403 | domain_not_verified | Sending domain not verified | | 403 | domain_not_found | Domain not registered to account | | 403 | account_inactive | Account suspended or inactive | | 403 | forbidden | API key domain/IP restriction | | 404 | not_found | Message ID not found | | 429 | rate_limit_exceeded | Rate limit reached (includes retry_after field) | | 500 | send_failed | Sending failed after failover | | 503 | service_unavailable | No healthy mail nodes | ## PHP Integration - `email.php` uses `Authorization: Bearer` header, curl over HTTPS (port 443 — no DO block) - Success returns `['success'=>true, 'message_id'=>'...']` - Failure returns `['success'=>false, 'error'=>'friendly message', 'error_type'=>'code', 'code'=>httpCode]` - 429 errors include retry_after seconds in the error message - **Required fields:** `from`, `to`, `subject`, `html` (or `text`) - **Optional:** `text`, `cc`, `bcc`, `reply_to`, `tags`, `metadata`, `headers` - **Success response:** 202 with `data.message_id`, `data.status` - **Domain must be verified** at platform.cyberpersons.com before sending ## SMTP Credentials (blocked by DigitalOcean — use API instead) - Host: mail.cyberpersons.com | Port: 587 | Security: STARTTLS - Username: `smtp_49a1fa9c0f15d2d7` - Password: `T3mOFSMK1SG1l4D1d7N8NefRd8xypwMy` - DO blocks outbound port 587 — API over HTTPS is the working approach ## Current Status - email.php rewritten to use CyberMail API (curl over HTTPS port 443) - `SendGridEmail` class renamed to `Email`, `sendEmail()` helper unchanged - Blocked by: `tomsjavajive.com` domain not verified in CyberMail dashboard - Fix: verify domain at platform.cyberpersons.com (add DNS TXT/CNAME records)