Index: pluggable.php
===================================================================
--- pluggable.php	(revision 16879)
+++ pluggable.php	(working copy)
@@ -247,6 +247,11 @@
  * However, you can set the content type of the email by using the
  * 'wp_mail_content_type' filter.
  *
+ * If $message is an array, the key of each is used to add as an attachment,
+ * with the value used as the body. The 'text/plain' element is used as the
+ * text version of the body, with the 'text/html' element used as the HTML
+ * version of the body. All other types are added as attachments.
+ *
  * The default charset is based on the charset used on the blog. The charset can
  * be set using the 'wp_mail_charset' filter.
  *
@@ -263,7 +268,7 @@
  *
  * @param string|array $to Array or comma-separated list of email addresses to send message.
  * @param string $subject Email subject
- * @param string $message Message contents
+ * @param string|array $message Message contents
  * @param string|array $headers Optional. Additional headers.
  * @param string|array $attachments Optional. Files to attach.
  * @return bool Whether the email contents were sent successfully.
@@ -332,6 +337,10 @@
 						}
 						break;
 					case 'content-type':
+						if ( is_array($message) ) {
+							// Multipart email, ignore the content-type header
+							break;
+						}
 						if ( strpos( $content, ';' ) !== false ) {
 							list( $type, $charset ) = explode( ';', $content );
 							$content_type = trim( $type );
@@ -403,10 +412,51 @@
 		$phpmailer->AddAddress( trim( $recipient ) );
 	}
 
+	// If we don't have a charset from the input headers
+	if ( !isset( $charset ) )
+		$charset = get_bloginfo( 'charset' );
+
+	// Set the content-type and charset
+	$phpmailer->CharSet = apply_filters( 'wp_mail_charset', $charset );
+
 	// Set mail's subject and body
 	$phpmailer->Subject = $subject;
-	$phpmailer->Body    = $message;
 
+	if ( is_string($message) ) {
+		$phpmailer->Body    = $message;
+
+		// Set Content-Type and charset
+		// If we don't have a content-type from the input headers
+		if ( !isset( $content_type ) )
+			$content_type = 'text/plain';
+
+		$content_type = apply_filters( 'wp_mail_content_type', $content_type );
+
+		$phpmailer->ContentType = $content_type;
+
+		// Set whether it's plaintext, depending on $content_type
+		if ( 'text/html' == $content_type )
+			$phpmailer->IsHTML( true );
+
+		// For backwards compatibility, new multipart emails should use
+		// the array style $message. This never really worked well anyway
+		if ( false !== stripos( $content_type, 'multipart' ) && ! empty($boundary) )
+			$phpmailer->AddCustomHeader( sprintf( "Content-Type: %s;\n\t boundary=\"%s\"", $content_type, $boundary ) );
+	}
+	elseif ( is_array($message) ) {
+		foreach ($message as $type => $body) {
+			if ($type === 'text/html') {
+				$phpmailer->Body = $body;
+			}
+			elseif ($type === 'text/plain') {
+				$phpmailer->AltBody = $body;
+			}
+			else {
+				$phpmailer->AddAttachment($body, '', 'base64', $type);
+			}
+		}
+	}
+
 	// Add any CC and BCC recipients
 	if ( !empty( $cc ) ) {
 		foreach ( (array) $cc as $recipient ) {
@@ -423,34 +473,11 @@
 	// Set to use PHP's mail()
 	$phpmailer->IsMail();
 
-	// Set Content-Type and charset
-	// If we don't have a content-type from the input headers
-	if ( !isset( $content_type ) )
-		$content_type = 'text/plain';
-
-	$content_type = apply_filters( 'wp_mail_content_type', $content_type );
-
-	$phpmailer->ContentType = $content_type;
-
-	// Set whether it's plaintext, depending on $content_type
-	if ( 'text/html' == $content_type )
-		$phpmailer->IsHTML( true );
-
-	// If we don't have a charset from the input headers
-	if ( !isset( $charset ) )
-		$charset = get_bloginfo( 'charset' );
-
-	// Set the content-type and charset
-	$phpmailer->CharSet = apply_filters( 'wp_mail_charset', $charset );
-
 	// Set custom headers
 	if ( !empty( $headers ) ) {
 		foreach( (array) $headers as $name => $content ) {
 			$phpmailer->AddCustomHeader( sprintf( '%1$s: %2$s', $name, $content ) );
 		}
-
-		if ( false !== stripos( $content_type, 'multipart' ) && ! empty($boundary) )
-			$phpmailer->AddCustomHeader( sprintf( "Content-Type: %s;\n\t boundary=\"%s\"", $content_type, $boundary ) );
 	}
 
 	if ( !empty( $attachments ) ) {
