Skip to content

First commit: just trying out an email server. #1207

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: trunk
Choose a base branch
from

Conversation

ramonjd
Copy link
Member

@ramonjd ramonjd commented Apr 15, 2025

Related issues

  • Fixes #

Proposed Changes

Just testing forwarding WordPress emails to nodemailer.

The first iteration created a dedicated express server.

The second sets up a route on each site's express app. Each site has dedicated email host settings. This is more flexible as it allows users to set up different accounts for each site.

Questions/TODOs:

  • Add settings controls so that users can add their own email server
  • Add https://ethereal.email/ as an option
  • Support SMTP/IMAP/POP
  • For user who can't or won't provide email server details, could we set up an endpoint (with limiting) using WordPress.com's WordPressMailer? OR alternatively, route the emails to a fake "inbox" in Studio?
  • Should the port be dynamic? What would this look like? we can set up a route on each site's express server
  • Is there a better way? Mailpit only runs on Docker/installation
  • What about incoming emails, e.g., post by email. See: import { EmailSettings } from './email-server';??

Testing Instructions

Add an email and app password (use Gmail for testing, it's easier)
Click on WP Admin link on a site.
Then add a user, making sure to send them an email.
See if it works.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@ramonjd ramonjd self-assigned this Apr 15, 2025
@ramonjd ramonjd force-pushed the try/email-service branch from 8ff4e7f to 21fe069 Compare April 24, 2025 07:41
path.posix.join( PLAYGROUND_INTERNAL_MU_PLUGINS_FOLDER, '0-wp-mail.php' ),
`<?php
add_filter( 'wp_mail', function( $args ) {
$response = wp_remote_post( 'http://localhost:7777/email', array(
Copy link
Member Author

Choose a reason for hiding this comment

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

TODO: the port number should be dynamic.

It's set in the app.

  • PHP const?
  • WP option?
  • ...

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm thinking this should be copied to /mu-plugins/ for each separate site.

This would simplify setting internal constants for the port number.

Also, users might want use a customized or other local email server.

…d readability. Enhance ContentTabSettings with email configuration details and a user-friendly message about the email service. Remove unused mu-plugin related to email functionality.
@ramonjd ramonjd force-pushed the try/email-service branch from 21fe069 to 7104c3c Compare April 26, 2025 23:29
const app = express();
app.use( express.json() );

// @TODO: service should be configurable via Studio settings.
Copy link
Member Author

Choose a reason for hiding this comment

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

The default would be Ethereal catch all for all sites.

Should sites be able to use separate email services? For example, a user might want site x to use gmail and not care about other sites?

Or should settings affect all sites?

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

Successfully merging this pull request may close these issues.

2 participants