Added Mailchimp Email Adapter - #148
Conversation
Co-authored-by: Matej Bačo <matejbaco2000@gmail.com>
|
Thanks for contributing! This repository is a read-only mirror; development for this library happens in |
Greptile SummaryAdds a Mailchimp Transactional/Mandrill email adapter.
Confidence Score: 2/5The 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
Prompt To Fix All With AIFix 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 |
| if ($statusCode >= 200 && $statusCode < 300) { | ||
| $response->setDeliveredTo(\count($message->getTo())); | ||
| foreach ($message->getTo() as $to) { | ||
| $response->addResult($to['email']); | ||
| } |
There was a problem hiding this 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.
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.| '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() | ||
| ), | ||
| ], |
There was a problem hiding this 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.
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.
Rebased on latest main. Fixed namespace and updated adapter to current conventions.