File tree Expand file tree Collapse file tree 1 file changed +17
-6
lines changed Expand file tree Collapse file tree 1 file changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -292,12 +292,23 @@ private function create_message(){
292
292
* https://core.trac.wordpress.org/ticket/5007.
293
293
*/
294
294
295
- if ( $ this ->api_message ["From " ] == null ) {
295
+ if ($ this ->api_message ["From " ] == null ) {
296
296
$ from_name = 'WordPress ' ;
297
- // Get the site domain and get rid of www.
298
- $ sitename = strtolower ( $ _SERVER ['SERVER_NAME ' ] );
299
- if ( substr ( $ sitename , 0 , 4 ) == 'www. ' ) {
300
- $ sitename = substr ( $ sitename , 4 );
297
+ $ sitename = 'localhost ' ;
298
+
299
+ // Check if SERVER_NAME is set
300
+ if (isset ($ _SERVER ['SERVER_NAME ' ])) {
301
+
302
+ // Set sitename to SERVER_NAME
303
+ $ sitename = $ _SERVER ['SERVER_NAME ' ];
304
+
305
+ // Make it lowercase
306
+ $ sitename = strtolower ($ sitename );
307
+
308
+ // Get rid of www. if it exists
309
+ if (substr ($ sitename , 0 , 4 ) == 'www. ' ) {
310
+ $ sitename = substr ($ sitename , 4 );
311
+ }
301
312
}
302
313
303
314
$ from_email = 'wordpress@ ' . $ sitename ;
@@ -364,4 +375,4 @@ public function send(){
364
375
));
365
376
}
366
377
}
367
- ?>
378
+ ?>
You can’t perform that action at this time.
0 commit comments