{
    my $webmailStatus = $imp{'status'} || "disabled";

    return "    # webmail is disabled in this VirtualHost" 
	unless $webmailStatus eq 'enabled';

    my $webmailAccessType = $imp{'access'} || "SSL";	

    my $hordedir = '/home/httpd/html/horde';
    my $impdir = "$hordedir/imp";

    if ($webmailAccessType eq 'SSL' && $port ne "443")
    {
	$OUT .= <<'HERE';
    RewriteEngine on
    RewriteRule ^/webmail   https://%{HTTP_HOST}/webmail [L,R]
HERE
    }
    else
    {
        $OUT .= "    Alias       /webmail $impdir\n";
    }

    $OUT .= "    Alias       /horde $hordedir\n";

    # prevent unencrypted "backdoor" access 
    if ($webmailAccessType eq 'SSL' && $port ne '443')
    {
        $OUT .= "\n    <Location ~ \"/horde/*\">\n";
        $OUT .= "    RequireSSL on\n";
        $OUT .= "    </Location>\n";
    }
}
