Skip to content

Added Mailchimp Email Adapter - #148

Closed
deepshekhardas wants to merge 6 commits into
utopia-php:mainfrom
deepshekhardas:fix/pr-45-mailchimp
Closed

Added Mailchimp Email Adapter#148
deepshekhardas wants to merge 6 commits into
utopia-php:mainfrom
deepshekhardas:fix/pr-45-mailchimp

Conversation

@deepshekhardas

Copy link
Copy Markdown

Rebased on latest main. Fixed namespace and updated adapter to current conventions.

@github-actions

Copy link
Copy Markdown

Thanks for contributing! This repository is a read-only mirror; development for this library happens in packages/messaging in the utopia-php monorepo. Please open this pull request there instead.

@github-actions github-actions Bot closed this Jul 25, 2026
@greptile-apps

greptile-apps Bot commented Jul 25, 2026

Copy link
Copy Markdown

Greptile Summary

Adds a Mailchimp Transactional/Mandrill email adapter.

  • Sends HTML or text messages through Mandrill's messages/send endpoint.
  • Maps sender details, subject, content, and primary recipients.
  • Converts HTTP responses into the shared messaging Response format.

Confidence Score: 2/5

The PR is not safe to merge until Mandrill recipient outcomes are interpreted correctly and the supported email fields are preserved.

The adapter can report rejected recipients as delivered, suppress server failures, and silently omit CC, BCC, reply-to, and attachment data on reachable send paths.

Files Needing Attention: src/Utopia/Messaging/Adapter/Email/Mailchimp.php

Important Files Changed

Filename Overview
src/Utopia/Messaging/Adapter/Email/Mailchimp.php Adds the adapter, but misreports recipient-level delivery outcomes and silently drops several fields from the EmailMessage contract.

Fix All in Claude Code Fix All in Codex

Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 2
src/Utopia/Messaging/Adapter/Email/Mailchimp.php:58-62
**Recipient failures reported as delivered**

When Mandrill returns HTTP 200 with a recipient marked `rejected` or `invalid`, this branch ignores the per-recipient response and records every address as successful, causing `deliveredTo` and recipient results to report undelivered messages as delivered. HTTP 5xx responses also bypass both branches and return no recipient errors.

### Issue 2 of 2
src/Utopia/Messaging/Adapter/Email/Mailchimp.php:41-51
**Email fields are silently dropped**

When an `EmailMessage` contains CC or BCC recipients, a distinct reply-to address, or attachments, this payload never reads or sends those fields, causing copy recipients to receive nothing, replies to target the sender, and delivered messages to omit their attachments.

Reviews (1): Last reviewed commit: "fix(Mailchimp): move to correct director..." | Re-trigger Greptile

Comment on lines +58 to +62
if ($statusCode >= 200 && $statusCode < 300) {
$response->setDeliveredTo(\count($message->getTo()));
foreach ($message->getTo() as $to) {
$response->addResult($to['email']);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Recipient failures reported as delivered

When Mandrill returns HTTP 200 with a recipient marked rejected or invalid, this branch ignores the per-recipient response and records every address as successful, causing deliveredTo and recipient results to report undelivered messages as delivered. HTTP 5xx responses also bypass both branches and return no recipient errors.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/Utopia/Messaging/Adapter/Email/Mailchimp.php
Line: 58-62

Comment:
**Recipient failures reported as delivered**

When Mandrill returns HTTP 200 with a recipient marked `rejected` or `invalid`, this branch ignores the per-recipient response and records every address as successful, causing `deliveredTo` and recipient results to report undelivered messages as delivered. HTTP 5xx responses also bypass both branches and return no recipient errors.

How can I resolve this? If you propose a fix, please make it concise.

Fix in Claude Code Fix in Codex

Comment on lines +41 to +51
'message' => [
'html' => $message->isHtml() ? $message->getContent() : null,
'text' => $message->isHtml() ? null : $message->getContent(),
'subject' => $message->getSubject(),
'from_email' => $message->getFromEmail(),
'from_name' => $message->getFromName(),
'to' => array_map(
fn(array $to) => ['email' => $to['email'], 'name' => $to['name'] ?? ''],
$message->getTo()
),
],

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Email fields are silently dropped

When an EmailMessage contains CC or BCC recipients, a distinct reply-to address, or attachments, this payload never reads or sends those fields, causing copy recipients to receive nothing, replies to target the sender, and delivered messages to omit their attachments.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/Utopia/Messaging/Adapter/Email/Mailchimp.php
Line: 41-51

Comment:
**Email fields are silently dropped**

When an `EmailMessage` contains CC or BCC recipients, a distinct reply-to address, or attachments, this payload never reads or sends those fields, causing copy recipients to receive nothing, replies to target the sender, and delivered messages to omit their attachments.

How can I resolve this? If you propose a fix, please make it concise.

Fix in Claude Code Fix in Codex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants