admin管理员组

文章数量:1208153

I am attempting to create HTML emails in woocommerce. I currently only have the plain text email option available. I have added the following to functions.php on my theme:

function wps_set_content_type(){
  return "text/html";
}
add_filter( 'wp_mail_content_type','wps_set_content_type' );

As well I have installed the following php modules php-gd, php-xml and php-xmlrpc. I have restarted apache after installation and verified that all modules are available.

The odd thing is that when I check the options locally, I have the HTML option. When I check on the live server there is only the plain text option. Locally I am running PHP 5.6.14-1+deb.sury~trusty+1 (cli) on the live server I am running PHP 7.0.20 (cli) (built: Jun 10 2017 06:34:07) ( NTS ). Surely PHP7 can handle this right?

Does anyone have a clue on what else I could try?

I am attempting to create HTML emails in woocommerce. I currently only have the plain text email option available. I have added the following to functions.php on my theme:

function wps_set_content_type(){
  return "text/html";
}
add_filter( 'wp_mail_content_type','wps_set_content_type' );

As well I have installed the following php modules php-gd, php-xml and php-xmlrpc. I have restarted apache after installation and verified that all modules are available.

The odd thing is that when I check the options locally, I have the HTML option. When I check on the live server there is only the plain text option. Locally I am running PHP 5.6.14-1+deb.sury.org~trusty+1 (cli) on the live server I am running PHP 7.0.20 (cli) (built: Jun 10 2017 06:34:07) ( NTS ). Surely PHP7 can handle this right?

Does anyone have a clue on what else I could try?

Share Improve this question asked Jul 28, 2017 at 19:38 codacopiacodacopia 1214 bronze badges 1
  • Then something else has gone wrong. The PHP DOM extension, php-xml, should be enough provided it's installed and enabled correctly. In php -a try echo class_exists( 'DOMDocument' ); and you should see "1" printed. – Rup Commented Apr 27, 2021 at 15:42
Add a comment  | 

1 Answer 1

Reset to default 1

I think you missing function argument. just try it.

add_filter('wp_mail_content_type','set_content_type');
    function set_content_type($content_type){
      return 'text/html';
    }

本文标签: phpWoocommerce HTML email option unavailable