Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#56500 closed feature request (worksforme)

WordPress sends email from a fixed address which will not work in my environment

Reported by: brivets's profile brivets Owned by:
Milestone: Priority: normal
Severity: normal Version: 6.0.2
Component: Mail Keywords:
Focuses: Cc:

Description

In wp-includes/pluggable.php there is code that builds a From line for sending error messages. I am working in a constrained environment and there is only one From line from which I am allowed to send email. Currently I have to edit pluggable.com every time there is a new release - it would be good if there were some way of configuring a fixed address that could be used. I appreciate that an option would not work if there were database issues, though that would be good where there weren't, or a define in config.

Change History (2)

#1 @brivets
2 years ago

ugh. pluggable.php not pluggable.com

#2 @TimothyBlynJacobs
2 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed

Hi @brivets,

Welcome to Trac!

This is already possible by using the wp_mail_from and wp_mail_from_name filters. You can also work at a lower level by interacting with PHPMailer directly using the phpmailer_init action.

add_filter( 'wp_mail_from', function () {
        return 'your@email.org';
} );

add_filter( 'wp_mail_from_name', function () {
        return 'Your Name';
} );
Note: See TracTickets for help on using tickets.