Aller au contenu
Email Servers

Brand Roundcube Webmail per Domain on a Shared Mail Server

Put one PNG per webmail hostname in a branding folder, then set skin_logo in config.inc.php from $_SERVER['SERVER_NAME'] with a placeholder fallback.

Testé sur Roundcube 1.6, Elastic skin

When one server hosts mail for several businesses, each customer should see their own brand on the webmail login page – not yours. Roundcube can switch the logo automatically based on the hostname the user visits, such as webmail.customer-a.com or mail.customer-b.com.

Step 1 – Create a branding folder

Terminal
sudo mkdir -p /var/www/roundcube/branding

Adjust the path if Roundcube is installed elsewhere.

Step 2 – Add one logo per webmail hostname

Upload a PNG for each domain, named exactly after the hostname users visit, plus a default:

Files
/var/www/roundcube/branding/webmail.customer-a.com.pngn/var/www/roundcube/branding/mail.customer-b.com.pngn/var/www/roundcube/branding/placeholder.png

Step 3 – Choose the logo in config.inc.php

Terminal
sudo nano /var/www/roundcube/config/config.inc.php

Add:

config.inc.php
// Per-domain logo: branding/u003chostnameu003e.png, else placeholder.pngn$host = preg_replace( '/[^a-z0-9.-]/', '', strtolower( $_SERVER['SERVER_NAME'] ?? '' ) );n$logo = $host . '.png';nif ( $host u0026u0026 file_exists( __DIR__ . '/../branding/' . $logo ) ) {n    $config['skin_logo'] = '../../branding/' . $logo;n} else {n    $config['skin_logo'] = '../../branding/placeholder.png';n}

The hostname is sanitised before it is used in a file path, so a crafted Host header can’t point Roundcube at other files.

Step 4 – Test

Open each webmail address in a private window – the login page shows that customer’s logo, and unknown hostnames fall back to the placeholder.

Recent Roundcube versions

Roundcube 1.5+ also accepts per-skin and per-template logos as an array, e.g. $config['skin_logo'] = [ 'elastic:login' => '…', '*' => '…' ];. Combine it with the hostname logic above if you want a different login-page logo.

Inder Kochar

Écrit par

Inder Kochar

Ingénieur systèmes et réseaux – Je rédige les solutions que j’applique chez mes clients, testées sur de vrais systèmes. Bloqué sur un problème similaire ?

Continuer la lecture

Posez une question ou partagez votre solution

Votre e-mail n’est pas publié. Les commentaires sont modérés – merci de rester dans le sujet.