Opened 8 years ago
Closed 8 years ago
#38161 closed defect (bug) (duplicate)
wp_mail() fails when run from wp-cli
Reported by: | desmith | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Keywords: | has-patch needs-testing | |
Focuses: | Cc: |
Description
In wp-includes/pluggable.php, lines 324-332, wp_mail() handles the case where no From: header is provided to an email, by attempting to create one (wordpress@domain).
The domain is determined by looking at $_SERVER['SERVER_NAME']
, which fails when wp_mail is called outside of the context of a Web server (i.e. if called from a wp-cli script).
Using something like substr( home_url( '', 'http'),7)
might be a suitable substitute when $_SERVER is unavailable. (If there's a better way to get a site's hostname than slicing up home_url() that of course would work too.)
Attachments (1)
Change History (4)
Note: See
TracTickets for help on using
tickets.
First stab at patch for 38161