GMAIL DELIVERY TEST HANDOFF Prepared: 2026-10-21 OBJECTIVE Investigate, with controlled tests on the owner's own mailboxes, whether genuine replies, Gmail-initiated conversations, or explicit recipient feedback improve subsequent Inbox placement for mail sent from the owner's domain and IP. Identify what can actually be reused from an incoming reply, implement an isolated test harness if needed, and record the measured results. Do not promise an Inbox guarantee or claim that a reply contains a reusable Google trust token. ENVIRONMENT AND TEST IDENTITIES - Gmail API application: /var/www/html - Framework: Laravel 11.20.0, PHP 8.2, PostgreSQL. - Application domain containing this connection: runwaydo.com - Authorized test Gmail: zombiescloud454501@gmail.com - Owner's domain test mailbox: admin@good-ideas.info - Domain sending IP for this experiment: 151.80.142.110 - All test email recipients must be one of the two addresses above. - The sending IP is not necessarily an SSH host or the API application's host. - A fresh Codex session must have authorized shell access to the API server and its Laravel environment/database. This document alone does not grant access. ACCOUNT LOOKUP (RECHECK THESE AGAINST THE LIVE DATABASE) - Primary encrypted connection table: inbox_connections - Model: App\Models\Inbox\Connection - Lookup by both email zombiescloud454501@gmail.com and domain runwaydo.com. - Connection ID at preparation: a304dc5f-99f7-4279-a9de-846462bb1f5c - Google project row ID at preparation: 275 - Linked legacy accounts row ID at preparation: 17537 - Stored granted_scopes at preparation: https://mail.google.com/ https://www.googleapis.com/auth/gmail.settings.basic - Access and refresh credentials are present. Availability and actual permissions must still be checked at runtime; stored scopes do not prove a grant is valid. - Do not export access_token, refresh_token, client_secret, project JSON, the database password, Laravel APP_KEY, Cortex keys, or SSH credentials into files, prompts, browser responses, command output, or logs. - Prefer the encrypted connection model over reading credentials from accounts. - If running Codex on the Cortex server, perform Gmail operations on the API server through an existing authorized connection. Do not copy Google credentials to Cortex. No standalone public Gmail test endpoint is implied by this document. EXISTING BACKEND SERVICES 1. app/Services/Inbox/GmailReader.php - accessToken(Connection): obtains the current access credential and refreshes it through the existing backend mechanism when required. It also synchronizes linked account credentials. Keep the returned string in process memory only. - profile(string access): returns the authenticated Gmail address. Verify it equals the authorized test Gmail before reading or modifying messages. - find(string access, string rfcMessageId): exact RFC Message-ID search, including Spam/Trash. It returns Gmail API message IDs, not full message bodies. - reactionRead(string access, string path, array query): existing GET helper, useful for a narrowly scoped messages.list search. The token lookup sets its mailbox quota context. Do not use it as a sending endpoint. 2. app/Services/Inbox/GmailSyncHttp.php - read(Connection, access, path, query = [], missing = false) - batch(Connection, access, requests), maximum six reads per group. - Fixed Gmail HTTPS GET allowlist includes /profile, /history, /settings/sendAs, /messages/{gmail_id}, /threads/{thread_id}, and message attachments. - Uses shared quotas and sanitizes errors. missing=true treats HTTP 404 as null. - Does not send messages or change labels. 3. app/Services/Inbox/GmailBudget.php - Shared mailbox/project rolling quota reservations and cooldowns. - reserve(Connection, units) before additional direct HTTP operations. - Respect configured budgets, 429/quota errors, Retry-After, and backoff. 4. app/Services/Inbox/AccountRegistry.php - Existing linkage between encrypted connections and legacy mailbox tools. 5. app/Models/Inbox/Connection.php - Token fields use Laravel encrypted casts and are hidden from serialization. SAFE LOCAL ACCESS PREFLIGHT This reads the authenticated profile; it sends no message or changes Gmail labels. Normal token refresh may update the stored connection and linked account. runuser -u www-data -- php -d zend.exception_ignore_args=1 -d display_errors=0 -d log_errors=0 <<'PHP' make(Illuminate\Contracts\Console\Kernel::class)->bootstrap(); try { $email = 'zombiescloud454501@gmail.com'; $connection = App\Models\Inbox\Connection::where('email', $email) ->where('domain', 'runwaydo.com')->firstOrFail(); $reader = app(App\Services\Inbox\GmailReader::class); $access = $reader->accessToken($connection); $actual = $reader->profile($access); $verified = App\Services\Inbox\Workflow::canonicalEmail($actual) === App\Services\Inbox\Workflow::canonicalEmail($email); echo json_encode(['mailbox_verified' => $verified, 'email' => $verified ? $email : null]).PHP_EOL; } catch (Throwable $error) { echo json_encode(['ready' => false, 'reason' => $error instanceof App\Services\Inbox\WorkflowUnavailable ? $error->reason : 'preflight_failed']).PHP_EOL; } PHP SENDING SIDE - Inspect the actual sending application and its supported single-message test path before automating any domain-to-Gmail sends. Do not invent an HTTP endpoint, SSH login, SMTP password, campaign ID, or permission to change production routing. - The existing Cortex integration documentation is: /var/www/html/docs/inbox-workflow/CORTEX-HANDOFF-2026-10-17.md - That Repo API dispatches mapped saved campaigns. It is not automatically a single-message sender with arbitrary reply headers. Do not create worker tasks or run the production task/outbox processors to perform this experiment. - Keep the runtime Cortex integration on documented HTTPS/HMAC. Existing SSH access, if used, is for inspection under its existing authorization. - If the sender cannot be reached with existing authorized access, finish the local preflight/harness/prepared test messages, then ask for the missing sender project path or an existing access mechanism. Do not ask for secrets in chat. AUTOMATED EXPERIMENT SCOPE - Prepare a small, bounded run: at most six domain-to-Gmail test messages and two Gmail-to-domain messages, one physical send attempt at a time. No bulk lists. - Revalidate ownership/configuration, the exact SMTP envelope recipient, and the actual sending IP before dispatch. A To header alone does not set RCPT TO. - Use a unique readable subject per independent conversation and meaningful text. - Give each outgoing physical message a new unique RFC Message-ID; persist the plan and attempt state before dispatch. Discover Gmail IDs after actual arrival. - First measure baseline and genuine reply behavior. A Gmail-initiated conversation is a separate case. Reuse only actual parent IDs from the relevant conversation. - Recipient feedback may be tested by marking only an identified test message Not spam AFTER its original arrival labels have been recorded. Record this as a deliberate intervention; it is not evidence of natural Inbox delivery. - Do not add Contacts, Never-spam filters, forwarding, routing, or broad allowlists as part of the default run. Those are separate recipient-preference experiments. - Do not delete messages or empty Spam/Trash. Preserve the conversation and evidence. - Do not automatically star or react to unrelated messages. This experiment is independent of worker tasks, recorded completion, approval, and payment. - Change one factor at a time. A single test does not establish a global rule. - Use existing dependencies. Avoid changes to production worker/Cortex workflows. - Creating this document does not execute or schedule test messages; the operator starts the run by invoking the accompanying prompt in an authorized Codex session. CORRECT REPLY CONSTRUCTION - From: the actual authorized domain address admin@good-ideas.info. - To/envelope recipient: zombiescloud454501@gmail.com for domain follow-ups. - Subject: keep the conversation subject, with the usual Re: prefix for a reply. - In-Reply-To: the parent's RFC Message-ID, including angle brackets. - References: preserve the parent's existing References chain and append the parent's RFC Message-ID, without duplicating an existing ID. - Message-ID: a fresh unique ID for the outgoing message, not the parent's ID. - A Gmail API threadId is local to that Gmail mailbox and is not an SMTP header. - For Gmail-originated sends, users.messages.send accepts a base64url-encoded RFC email in raw and, for a reply, the appropriate Gmail threadId. - No special reply=true, compose=true, or deliver_to_inbox=true parameter exists. - Do not copy Google's DKIM/ARC signatures or X-Google headers onto new mail as a trust mechanism. Authenticate new domain messages with the domain's own setup. RETRIES AND EVIDENCE - Sending and delivery are different outcomes. A successful API/SMTP submission does not establish Gmail receipt, threading, or Inbox placement. - Maintain a private run ledger with message plan, unique IDs, attempts, recipient, send status, and timestamps. Never write credentials or raw authentication replies. - If an SMTP/API send times out after possible submission, mark outcome unknown. Do not resend automatically. Reconcile using the persisted IDs and sender records. - Use bounded polling and record pending/not observed rather than calling a missing message spam. Revoked access, API errors, and quota pauses are separate outcomes. - Match arrivals by exact RFC Message-ID, with sender/recipient checks. A subject alone is not sufficient. Do not match an old message as a fresh result. - Measure labels on the specific incoming message: INBOX, SPAM, TRASH, UNREAD. Do not infer placement from the visible conversation, SMTP acceptance, or a reply. - Record Google threadId separately, along with original/parent RFC Message-IDs, authentication results, source IP, and observations before/after interventions. - A report-not-spam action changes current state. Preserve the pre-intervention arrival result; do not rewrite it as an original Inbox delivery. - Gmail API does not provide the complete spam-classifier reason. Ask for the Gmail UI warning text if needed; do not invent a reputation score or root cause. - Store evidence outside public/, with restricted permissions and sanitized logs. - Report timestamps in Africa/Casablanca, or label UTC explicitly. DELIVERABLE A concise evidence table for each test case: sender/IP, parent reference, Gmail arrival ID, authentication status, conversation match, initial message labels, intervention (if any), subsequent follow-up result, and limitations. State whether the hypothesis was supported, contradicted, or remains inconclusive. Do not report a universal Inbox guarantee, and do not include any previous experiment history. REFERENCES https://www.rfc-editor.org/rfc/rfc5322.html#section-3.6.4 https://developers.google.com/workspace/gmail/api/guides/threads https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.messages/send https://support.google.com/mail/answer/16457426?co=GENIE.Platform%3DDesktop&hl=en https://workspace.google.com/blog/identity-and-security/an-overview-of-gmails-spam-filters