| 1 | Index: wp-includes/pluggable.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-includes/pluggable.php (revision 11438) |
|---|
| 4 | +++ wp-includes/pluggable.php (working copy) |
|---|
| 5 | @@ -249,9 +249,10 @@ |
|---|
| 6 | * @param string $message Message contents |
|---|
| 7 | * @param string|array $headers Optional. Additional headers. |
|---|
| 8 | * @param string|array $attachments Optional. Files to attach. |
|---|
| 9 | + * @param bool $preserve_quotes Optional. Preserve encoded quotes in plain text emails. |
|---|
| 10 | * @return bool Whether the email contents were sent successfully. |
|---|
| 11 | */ |
|---|
| 12 | -function wp_mail( $to, $subject, $message, $headers = '', $attachments = array() ) { |
|---|
| 13 | +function wp_mail( $to, $subject, $message, $headers = '', $attachments = array(), $preserve_quotes = false ) { |
|---|
| 14 | // Compact the input, apply the filters, and extract them back out |
|---|
| 15 | extract( apply_filters( 'wp_mail', compact( 'to', 'subject', 'message', 'headers', 'attachments' ) ) ); |
|---|
| 16 | |
|---|
| 17 | @@ -337,6 +338,14 @@ |
|---|
| 18 | } |
|---|
| 19 | } |
|---|
| 20 | |
|---|
| 21 | + if ( $preserve_quotes != true && ( !isset( $content_type ) || $content_type = 'text/plain' ) ) { |
|---|
| 22 | + // Ensure we don't send encoded quotes in plain text emails |
|---|
| 23 | + $encoded_quotes = array( '"', ''' ); |
|---|
| 24 | + $decoded_quotes = array( '"', "'" ); |
|---|
| 25 | + $subject = str_replace( $encoded_quotes, $decoded_quotes, $subject ); |
|---|
| 26 | + $message = str_replace( $encoded_quotes, $decoded_quotes, $message ); |
|---|
| 27 | + } |
|---|
| 28 | + |
|---|
| 29 | // Empty out the values that may be set |
|---|
| 30 | $phpmailer->ClearAddresses(); |
|---|
| 31 | $phpmailer->ClearAllRecipients(); |
|---|