Skip to content

Email reply-to snag on localhost #2094

Description

@Bloke

Expected behaviour

Performing an action (e.g. Add User) emails credentials out.

Actual behaviour

'Could not Email' announce message, with no other diagnostic or debugging context.

Steps to reproduce

  1. On localhost, set up a Textpattern instance under a subdirectory, e.g. localhost:8888/txp-492
  2. Log in and visit Admin->Users
  3. Add User account.

Additional information

Textpattern version: 4.9.2-dev

Web server vendor and version: MAMP/apache (local environment)

Database server vendor and version: MySQL 5.7.44

PHP version: 8.4.1

Operating system: MacOS Sequoia 15.7.7


The bug stems from the new(ish) reply-to fallback in function txpMail() in txplib_misc.php:

$sender['email'] = "no-reply@" . get_pref("siteurl");

Under localhost environments, the siteurl (domain) is often not valid, resulting in email addresses such as:

no-reply@localhost:8888/txp-492

When adding the 'from' address in the Mail Adapter, the filter_var() check fails with such bogus domain names, an exception is thrown (which is never revealed) and the mail is never sent.

A workaround is to set the Mail pref 'Send login details from this email address' to a valid domain, then the email is triggered correctly. So this isn't a show-stopping issue, but it is a minor unexpected annoyance.

Is it an unreasonable expectation to have to visit Prefs and set the sender before an action such as Add User can be performed? Is there any mileage in using a fallback-fallback, e.g. no-reply@example.org if the siteurl isn't a real domain? Or do we just leave this as-is and document it?

Activity

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

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions