| @@ -6,8 +6,10 @@ | ||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | namespace Timetics\Core\Emails; |
| 9 | 9 | |
| 10 | +defined( 'ABSPATH' ) || exit; | |
| 11 | + | |
| 10 | 12 | /** |
| 11 | 13 | * Class Email |
| 12 | 14 | */ |
| 13 | 15 | abstract class Email { |
| @@ -48,10 +50,22 @@ | ||
| 48 | 50 | * |
| 49 | 51 | * @return string |
| 50 | 52 | */ |
| 51 | 53 | public function get_headers() { |
| 54 | + $charset = get_bloginfo( 'charset' ); | |
| 55 | + $charset = $charset ? $charset : 'UTF-8'; | |
| 56 | + | |
| 52 | 57 | $headers = 'MIME-Version: 1.0' . "\r\n"; |
| 53 | - $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; | |
| 58 | + $headers .= 'Content-type: text/html; charset=' . $charset . "\r\n"; | |
| 59 | + $from = get_bloginfo( 'name' ); | |
| 60 | + $from_email = timetics_get_option('booking_created_customer_email_from'); | |
| 61 | + | |
| 62 | + if ( function_exists( 'mb_encode_mimeheader' ) ) { | |
| 63 | + $from = mb_encode_mimeheader( $from, $charset ); | |
| 64 | + } | |
| 65 | + | |
| 66 | + // Append the "From" header | |
| 67 | + $headers .= 'From: ' .$from. ' <' . $from_email . '> ' . "\r\n"; | |
| 54 | 68 | |
| 55 | 69 | return $headers; |
| 56 | 70 | } |
| 57 | 71 | |