diff --git a/composer.json b/composer.json index 193f1c953a0e4950f3a15268957e772c20ee9513..61aa3f158029f74dbcadb5238348d335ff70754f 100644 --- a/composer.json +++ b/composer.json @@ -51,13 +51,6 @@ } }, "autoload-dev": {}, - "extra": { - "text-domain": "wp-email", - "translations-folder": "lang", - "po-files": { - "pl_PL": "pl_PL.po" - } - }, "scripts": { "phpcs": "phpcs", "phpunit-unit": "phpunit --configuration phpunit-unit.xml --coverage-text --colors=never", diff --git a/src/Mailer.php b/src/Mailer.php index 18e98453ad270cfa57747ec11a56420fb8618ebd..348077d3f223534eeacab5092aeda7e99498ac1f 100644 --- a/src/Mailer.php +++ b/src/Mailer.php @@ -78,13 +78,21 @@ class Mailer { add_filter( 'wp_mail_from', $from_cb = static function () use ( $email ) { - return $email->get_from(); + if ( ! empty( $email->get_from() ) ) { + return $email->get_from(); + } + + return 'wordpress@siteurl.pl'; } ); add_filter( 'wp_mail_from_name', $from_name_cb = static function () use ( $email ) { - return $email->get_from_name(); + if ( ! empty( $email->get_from_name() ) ) { + return $email->get_from_name(); + } + + return 'wordpress'; } ); add_action( 'wp_mail_failed', [ $this, 'catch_error' ] ); @@ -138,5 +146,4 @@ class Mailer { return HTML::style_inline( $content, $styles ); } - }