Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

In cPanel, Horde does not display rich text/HTML emails by default, it only displays the plain text version. I know there is an option to display HTML emails, but I am not sure how to enable that under cPanel.

I read a lot of forum posts online saying that I need to set $mime_drivers['html']['inline']=true; in mime_drivers.php. However if I alter this file I am afraid that cPanel will overwrite it. cPanel has a tendency to overwrite files I modify.

How can I configure Horde under cPanel to display HTML emails?

share|improve this question
    
I love how I searched Google for "cPanel Horde display HTML emails" earlier today and was unable to find the right answer. So I post a ServerFault question and now the right answer is right there on the first results page of Google. Stack Exchange FTW! –  Josh Apr 6 '12 at 1:29

1 Answer 1

This question had me stumped for a long while. Months ago I was unable to find the answer and so I just edited /usr/local/cpanel/base/horde/imp/config/mime_drivers.php, specifically changing the section:

$mime_drivers['imp']['html'] = array(   
    'inline' => false,

to:

$mime_drivers['imp']['html'] = array(   
    'inline' => true,

As I feared, every time cPanel updated Horde, this change would be lost and my users would complain. Now, I believe I have found a solution. (However Horde has not yet updated so I am unable to tell for sure if this works).

After including imp/config/mime_drivers.php, Horde will check for a directory imp/config/mime_drivers.d/ and, if found, will include() all files ending in .php in that directory. This directory does not exist under cPanel, so it can be created without fear of being overwritten.

The file /usr/local/cpanel/src/3rdparty/gpl/README-horde contains details on how cPanel updates Horde, as well as instructions on customizing Horde. A few relevant excepts of that file give clues as to how to make the customizations I wanted permanently:

During the maintenance phase of /scripts/upcp and /scripts/maintenance, the webmail script found at /usr/local/cpanel/install/webmail is executed. This in turn executes /usr/local/cpanel/bin/update-horde. Presented below is an outline of steps update-horde performs:

  1. The Horde installation is wiped clean (rm -rf /usr/local/cpanel/base/horde).
  2. Using the version specified in update-horde, the appropriate Horde source tarball will be extracted to /usr/local/cpanel/base.

[...]

After determining which tarball to use for the source install, and extracting it, the update-horde script checks for the following:

    o /var/cpanel/horde/overlay.tar
    o /var/cpanel/horde/overlay.tar.gz
    o /var/cpanel/horde/overlay.$hordever.tar
    o /var/cpanel/horde/overlay.$hordever.tar.gz

As with the prior tarballs, the value of $hordever must match what is defined in the update-horde script. The overlay tarball provides a simple way of customizing specific aspects of Horde. For example, certain graphics, themes, modules, plugins and the like can all be provided as an overlay. Since it is extracted into /usr/local/cpanel/base, the contents of the tarball must match the directory layout found in /usr/local/cpanel/base/horde.

From this file I was able to discover the following steps to override the inline HTML view setting is as follows:

tl;dr: here are the steps:

  1. In a temporary directory, create the horde/imp/config/mime_drivers.d/ directory structure which cPanel expects:

    mkdir -p /tmp/horde/imp/config/mime_drivers.d
    
  2. Create an override file in that new directory. I named mine html.php but you can name it anything you like as long as it ends in .php

  3. Insert the following contents into /tmp/horde/imp/config/mime_drivers.d/html.php:

    <?php
    /**
     * HTML driver settings
     */
    $mime_drivers['imp']['html'] = array(
        'inline' => true,
        'handles' => array(
            'text/html'
        ),
        'icons' => array(
            'default' => 'html.png'
        ),
        /* If you don't want to display the link to open the HTML content in a
         * separate window, set the following to false. */
        'external' => true,
        /* Run 'tidy' on all HTML output? This requires at least version 2.0 of the
         * PECL 'tidy' extension to be installed on your system. */
        'tidy' => false,
        /* Check for phishing exploits? */
        'phishing_check' => true
    );
    
  4. Create a .tar.gz version of the /tmp/horde directory at /var/cpanel/horde/overlay.tar.gz:

    cd /tmp
    tar -czvf /var/cpanel/horde/overlay.tar.gz horde
    

    This file should be expanded by cPanel every time Horde is updated, re-adding your configuration override.

  5. Move the /tmp/horde/imp/config/mime_drivers.d/ into place:

    mv /tmp/horde/imp/config/mime_drivers.d /usr/local/cpanel/base/horde/imp/config/
    
  6. Log in to Horde to test.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.