Filter and Hooks, Programming

Issue : Outlook Overriding Font from Arial to Times New Roman

If your are receiving the email on Outlook in Times New Roman, add the following code inside the head tag.

<!--[if mso]>
<style type="text/css">
      body, table, td, div, span, p, a, h1, h2, h3, li {font-family: Arial, Helvetica, sans-serif !important;}
</style>
<![endif]-->

If you are facing the similar issue in CF7 (contact form 7),  just attach the script in the body using CF7 filter.

add_filter('wpcf7_mail_components','app_custom_mail', 10,2);
function app_custom_mail($mail_component, $contact_form){
	 $mail_component['body'] =' <!--[if mso]>
	<style type="text/css">
			body, table, td, div, span, p, a {font-family: Arial, Helvetica, sans-serif !important;line-height: 1.5;}
	</style>
	<![endif]-->';
	$mail_component['body'] .= get_field("rule","options"); // getting the body content of email from back-office advanced custom field options page
	
   return $mail_component;
}

P.S. This resolved my issue 🙂 .

Views: 57

Standard

3 thoughts on “Issue : Outlook Overriding Font from Arial to Times New Roman

  1. Hmm is anyone else having problems with the images on this blog loading?
    I’m trying to find out if its a problem on my end or if it’s the blog.

    Any suggestions would be greatly appreciated.

  2. kabita@admin says:

    There are numerous measures to prevent site from hackers . Few steps are :

    1. Install iThemes Security and configure it.
    2. Change the default login url
    3. Set strong passwords
    4. Don’t allow to load php files in the uploads and wp-content folder.
    For this, create .htaccess file , add ‘ Options -Indexes ‘ in the file and place it inside the wp-content and upload folder
    5. Redirect to homepage if the author id is 1 :

    To redirect user with id 1 to homepage , add below code in your functions.php

    /*
    * Redirect to home page if author is 1
    */
    add_action(‘template_redirect’, ‘app_template_redirect’);
    function app_template_redirect(){
    if (is_author()){
    wp_redirect( home_url() ); exit;
    }
    }

Comments are closed.