diff --git a/includes/class-wp-job-manager-email-notifications.php b/includes/class-wp-job-manager-email-notifications.php index c6b6d7ed0..6455c3976 100644 --- a/includes/class-wp-job-manager-email-notifications.php +++ b/includes/class-wp-job-manager-email-notifications.php @@ -18,7 +18,7 @@ final class WP_Job_Manager_Email_Notifications { const EMAIL_SETTING_PREFIX = 'job_manager_email_'; const EMAIL_SETTING_ENABLED = 'enabled'; const EMAIL_SETTING_PLAIN_TEXT = 'plain_text'; - const MULTIPART_BOUNDARY = '--jm-boundary'; + const MULTIPART_BOUNDARY = 'jm-boundary'; /** * Notifications to be scheduled. @@ -976,6 +976,15 @@ private static function get_styles() { private static function get_multipart_body( string $content_html, string $content_plain ): string { $multipart_body = ''; + if ( ! empty( $content_plain ) ) { + + $multipart_body .= ' +--' . self::MULTIPART_BOUNDARY . ' +Content-Type: text/plain; charset="utf-8" + +' . $content_plain; + } + if ( ! empty( $content_html ) ) { $multipart_body .= ' --' . self::MULTIPART_BOUNDARY . ' @@ -984,13 +993,10 @@ private static function get_multipart_body( string $content_html, string $conten ' . $content_html; } - if ( ! empty( $content_plain ) ) { - + if ( ! empty( $multipart_body ) ) { $multipart_body .= ' ---' . self::MULTIPART_BOUNDARY . ' -Content-Type: text/plain; charset="utf-8" - -' . $content_plain; +--' . self::MULTIPART_BOUNDARY . '-- +'; } return $multipart_body;