Skip to content

Add Netcore Email adapter - #145

Closed
deepshekhardas wants to merge 1 commit into
utopia-php:mainfrom
deepshekhardas:fix/pr-53-netcore
Closed

Add Netcore Email adapter#145
deepshekhardas wants to merge 1 commit into
utopia-php:mainfrom
deepshekhardas:fix/pr-53-netcore

Conversation

@deepshekhardas

Copy link
Copy Markdown

Rebased on latest main with code adaptation.

Adapted from original PR #53 (by codingmickey):

  • Moved file from Adapters/Email/ to Adapter/Email/
  • Updated namespace from Utopia\Messaging\Adapters\Email to Utopia\Messaging\Adapter\Email
  • Added parent::__construct() call
  • Updated process() return type from string to array
  • Fixed request() call to pass array body (not json_encoded)
  • Added proper response handling using Response class
  • Dropped CI/docker changes (outdated)

@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 Netcore email provider integration.

  • Introduces the Netcore adapter, including regional endpoint selection, request construction, and response conversion.
  • Adds an end-to-end send test driven by Netcore credentials and a test recipient.

Confidence Score: 1/5

This PR is not safe to merge because the new adapter cannot successfully construct a normal email request and also misrepresents recipients and plain-text content.

Every send invokes a nonexistent Email accessor; after that is corrected, recipient records are still converted to "Array", while default plain-text messages are labeled as AMP.

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

Important Files Changed

Filename Overview
src/Utopia/Messaging/Adapter/Email/Netcore.php Adds the adapter, but its sender accessor, recipient conversion, and plain-text content mapping make the normal send path fail or produce an invalid request.
tests/e2e/Email/NetcoreTest.php Adds basic end-to-end coverage, although its default plain-text message directly exercises the adapter's incorrect AMP mapping.

Fix All in Claude Code Fix All in Codex

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

---

### Issue 1 of 3
src/Utopia/Messaging/Adapter/Email/Netcore.php:46
**Undefined sender accessor breaks sends**

When any email is sent through this adapter, `process()` calls `Email::getFrom()`, but the message exposes only `getFromName()` and `getFromEmail()`, causing an undefined-method error before the HTTP request is issued.

### Issue 2 of 3
src/Utopia/Messaging/Adapter/Email/Netcore.php:45
**Recipient records stringify as Array**

When a message has recipients, `getTo()` returns nested recipient records that are passed directly to `implode()`, producing `Array` instead of email addresses in the provider payload and delivery results, which causes request rejection and unusable response data.

### Issue 3 of 3
src/Utopia/Messaging/Adapter/Email/Netcore.php:49
**Plain text is mislabeled as AMP**

When an email uses the default `html=false` setting, this branch labels its plain-text body as `amp` rather than text, causing ordinary messages to be rejected by the provider or rendered incorrectly.

Reviews (1): Last reviewed commit: "feat: add Netcore Email adapter" | Re-trigger Greptile

],
body: [
'to' => \implode(',', $message->getTo()),
'from' => $message->getFrom(),

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 Undefined sender accessor breaks sends

When any email is sent through this adapter, process() calls Email::getFrom(), but the message exposes only getFromName() and getFromEmail(), causing an undefined-method error before the HTTP request is issued.

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

Comment:
**Undefined sender accessor breaks sends**

When any email is sent through this adapter, `process()` calls `Email::getFrom()`, but the message exposes only `getFromName()` and `getFromEmail()`, causing an undefined-method error before the HTTP request is issued.

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

Fix in Claude Code Fix in Codex

'Content-Type: application/json',
],
body: [
'to' => \implode(',', $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 Recipient records stringify as Array

When a message has recipients, getTo() returns nested recipient records that are passed directly to implode(), producing Array instead of email addresses in the provider payload and delivery results, which causes request rejection and unusable response data.

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

Comment:
**Recipient records stringify as Array**

When a message has recipients, `getTo()` returns nested recipient records that are passed directly to `implode()`, producing `Array` instead of email addresses in the provider payload and delivery results, which causes request rejection and unusable response data.

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

Fix in Claude Code Fix in Codex

'from' => $message->getFrom(),
'subject' => $message->getSubject(),
'content' => [
'type' => $message->isHtml() ? 'html' : 'amp',

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 Plain text is mislabeled as AMP

When an email uses the default html=false setting, this branch labels its plain-text body as amp rather than text, causing ordinary messages to be rejected by the provider or rendered incorrectly.

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

Comment:
**Plain text is mislabeled as AMP**

When an email uses the default `html=false` setting, this branch labels its plain-text body as `amp` rather than text, causing ordinary messages to be rejected by the provider or rendered incorrectly.

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