From 1a3c14d8a9c34fcd533fa2150445f12d461a5a13 Mon Sep 17 00:00:00 2001 From: Matt Mullenweg Date: Mon, 4 Oct 2004 07:44:04 +0000 Subject: [PATCH] Use mb_mail_send if available. git-svn-id: https://develop.svn.wordpress.org/trunk@1733 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/users.php | 2 +- wp-includes/functions.php | 14 +++++++++++--- wp-login.php | 4 ++-- wp-register.php | 2 +- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/wp-admin/users.php b/wp-admin/users.php index 003b64954e..caee4a0164 100644 --- a/wp-admin/users.php +++ b/wp-admin/users.php @@ -95,7 +95,7 @@ case 'adduser': $message = 'New user registration on your blog ' . get_settings('blogname') . ":\r\n\r\n"; $message .= "Login: $user_login\r\n\r\nE-mail: $user_email"; - @mail(get_settings('admin_email'), '[' . get_settings('blogname') . '] New User Registration', $message); + @wp_mail(get_settings('admin_email'), '[' . get_settings('blogname') . '] New User Registration', $message); header('Location: users.php'); break; diff --git a/wp-includes/functions.php b/wp-includes/functions.php index b6d6af16ec..1793a02bf3 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -1003,7 +1003,7 @@ function wp_notify_postauthor($comment_id, $comment_type='comment') { . "$from\r\n" . "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\r\n"; - @mail($user->user_email, $subject, $notify_message, $message_headers); + @wp_mail($user->user_email, $subject, $notify_message, $message_headers); return true; } @@ -1046,7 +1046,7 @@ function wp_notify_moderator($comment_id) { . "$from\r\n" . "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\r\n"; - @mail($admin_email, $subject, $notify_message, $message_headers); + @wp_mail($admin_email, $subject, $notify_message, $message_headers); return true; } @@ -1796,4 +1796,12 @@ function htmlentities2($myHTML) { return preg_replace("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/","&" , strtr($myHTML, $translation_table)); } -?> + +function wp_mail($to, $subject, $message, $headers = '', $more = '') { + if ( function_exists('mb_send_mail') ) + return mb_send_mail($to, $subject, $message, $headers, $more); + else + return mail($to, $subject, $message, $headers, $more); +} + +?> \ No newline at end of file diff --git a/wp-login.php b/wp-login.php index d177e5dc57..5c04850c5e 100644 --- a/wp-login.php +++ b/wp-login.php @@ -148,7 +148,7 @@ case 'retrievepassword': $message .= __('Password') . ": $user_pass\r\n"; $message .= get_settings('siteurl') . '/wp-login.php'; - $m = mail($user_email, sprintf(__("[%s] Your login and password"), get_settings('blogname')), $message); + $m = wp_mail($user_email, sprintf(__("[%s] Your login and password"), get_settings('blogname')), $message); if ($m == false) { echo '

' . __('The e-mail could not be sent.') . "
\n"; @@ -158,7 +158,7 @@ case 'retrievepassword': echo '

' . sprintf(__("The e-mail was sent successfully to %s's e-mail address."), $user_login) . '
'; echo "" . __('Click here to login!') . '

'; // send a copy of password change notification to the admin - mail(get_settings('admin_email'), sprintf(__('[%s] Password Lost/Change'), get_settings('blogname')), sprintf(__('Password Lost and Changed for user: %s'), $user_login)); + wp_mail(get_settings('admin_email'), sprintf(__('[%s] Password Lost/Change'), get_settings('blogname')), sprintf(__('Password Lost and Changed for user: %s'), $user_login)); die(); } diff --git a/wp-register.php b/wp-register.php index 20dccd91a0..c2a2b3de9e 100644 --- a/wp-register.php +++ b/wp-register.php @@ -103,7 +103,7 @@ case 'register': $message = sprintf(__("New user registration on your blog %1\$s:\n\nLogin: %2\$s \n\nE-mail: %3\$s"), get_settings('blogname'), $user_login, $user_email); - @mail(get_settings('admin_email'), sprintf(__('[%s] New User Registration'), get_settings('blogname')), $message); + @wp_mail(get_settings('admin_email'), sprintf(__('[%s] New User Registration'), get_settings('blogname')), $message); ?>