Package: wordpress
Version: 2.2.2-1
Severity: normal
Tags: patch

There is a bug in PHPMailer usage, wich breaks mail's encoding
sometimes. I don't know does it affect core functionality, but some
pluging sends mails with broken encoding in headers.

I reviewed code, and fixed it a little bit. Patch is attached.


-- System Information:
Debian Release: lenny/sid
  APT prefers testing-proposed-updates
  APT policy: (700, 'testing-proposed-updates'), (700, 'testing'), (670, 
'proposed-updates'), (670, 'stable'), (600, 'unstable'), (550, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.22-1-vserver-686 (SMP w/2 CPU cores)
Locale: LANG=ru_RU.KOI8-R, LC_CTYPE=ru_RU.KOI8-R (charmap=KOI8-R)
Shell: /bin/sh linked to /bin/bash
--- /usr/share/wordpress/wp-includes/pluggable.php.orig 2007-08-09 
12:12:39.000000000 +0400
+++ /usr/share/wordpress/wp-includes/pluggable.php      2007-08-09 
12:19:56.000000000 +0400
@@ -170,12 +170,6 @@
        $mail = apply_filters('wp_mail', $mail);
        extract($mail, EXTR_SKIP);
 
-       if ( $headers == '' ) {
-               $headers = "MIME-Version: 1.0\n" .
-                       "From: " . apply_filters('wp_mail_from', "wordpress@" . 
preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME']))) . "\n" . 
-                       "Content-Type: text/plain; charset=\"" . 
get_option('blog_charset') . "\"\n";
-       }
-
        $phpmailer->ClearAddresses();
        $phpmailer->ClearCCs();
        $phpmailer->ClearBCCs();
@@ -183,7 +177,9 @@
        $phpmailer->ClearAllRecipients();
        $phpmailer->ClearCustomHeaders();
 
+       $phpmailer->CharSet = get_option('blog_charset');
        $phpmailer->FromName = "WordPress";
+       $phpmailer->From = get_option('admin_email');
        $phpmailer->AddAddress("$to", "");
        $phpmailer->Subject = $subject;
        $phpmailer->Body    = $message;

Reply via email to