• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Resolved onyx custom template webmail

moswak

Regular Pleskian
Hi,

centos7
Plesk onyx

in Plesk 12.5 i created in /templates/custom/roundcube.php another alias
i edited
ServerAlias roundcube.webmail.*
to
ServerAlias roundcube.webmail.* mailcc.serverdomain.com

and roundcube was reachable under mailcc.serverdomain.com

but now in onyx the roundcube.php is different and there is no line i can edit ServerAlias
i found in /usr/local/psa/admin/conf/templates/default/webmail/webmail.php
copy this to /usr/local/psa/admin/conf/templates/custom/webmail/webmail.php

Code:
ServerName "webmail.<?php echo $VAR->domain->asciiName ?>"
    <?php foreach ($VAR->domain->mailAliases as $alias): ?>
        ServerAlias  "webmail.<?php echo $alias->asciiName ?>"
    <?php endforeach; ?>

i changed to

Code:
ServerName "webmail.<?php echo $VAR->domain->asciiName ?>"
    <?php foreach ($VAR->domain->mailAliases as $alias): ?>
        ServerAlias  "webmail.<?php echo $alias->asciiName ?>" mailcc.serverdomain.com
    <?php endforeach; ?>

but this doesnt work.
Where is my error ?
 
Code:
ServerAlias "webmail.<?php echo $alias->asciiName ?> mailcc.serverdomain.com"

Does not work :-(

what about /usr/local/psa/admin/conf/templates/default/webmail/nginxWebmailPartial.php ?
but there is no ServerAlias only server_name
 
Hi moswak,

Source: /usr/local/psa/admin/conf/templates/default/webmail/nginxWebmailPartial.php / line 8-14
Code:
<?php foreach ($VAR->domain->webmail->ipAddresses as $ipAddress): ?>
server {
    listen <?php echo $ipAddress->escapedAddress . ':' . $OPT['frontendPort'] . ($OPT['ssl'] ? ' ssl' : '') ?>;
    server_name "webmail.<?php echo $VAR->domain->asciiName ?>";
    <?php foreach ($VAR->domain->mailAliases as $alias): ?>
        server_name  "webmail.<?php echo $alias->asciiName ?>";
    <?php endforeach; ?>
 
Hi moswak,

must i edit both lines with server_name " ?
well, one is for the situation, that you have some aliases configured - so it makes sense to edit both. ;)

Btw.: Pls. remember, that the file "webmail.php" is the template for apache and the file "nginxWebmailPartial.php" is the template for nginx. You should always make sure to edit both depending files, when you make custom changes. ;)
 
Last edited by a moderator:
Code:
listen <?php echo $ipAddress->escapedAddress . ':' . $OPT['frontendPort'] . ($OPT['ssl'] ? ' ssl' : '') ?>;
    server_name "webmail.<?php echo $VAR->domain->asciiName ?> mailcc.serverdomain.com";
    <?php foreach ($VAR->domain->mailAliases as $alias): ?>
        server_name  "webmail.<?php echo $alias->asciiName ?> mailcc.serverdomain.com";

Does not work :-(

edit: and the normal webmail.domain.com loads without css.
I make the changes undo
 
Hi moswak,


Code:
ServerAlias "webmail.<?php echo $alias->asciiName ?> mailcc.serverdomain.com"

I was a little rash with my above answer. Actually, you should use:

For Apache ( webmail.php ) :
Code:
    ServerName "webmail.<?php echo $VAR->domain->asciiName ?>"
    ServerAlias "webmail.<?php echo $VAR->domain->asciiName ?>" "mailcc.serverdomain.com"
    <?php foreach ($VAR->domain->mailAliases as $alias): ?>
        ServerAlias  "webmail.<?php echo $alias->asciiName ?>"
    <?php endforeach; ?>

For nginx ( nginxWebmailPartial.php ) :
Code:
<?php foreach ($VAR->domain->webmail->ipAddresses as $ipAddress): ?>
server {
    listen <?php echo $ipAddress->escapedAddress . ':' . $OPT['frontendPort'] . ($OPT['ssl'] ? ' ssl' : '') ?>;
    server_name "webmail.<?php echo $VAR->domain->asciiName ?>" "mailcc.serverdomain.com";
    <?php foreach ($VAR->domain->mailAliases as $alias): ?>
        server_name  "webmail.<?php echo $alias->asciiName ?>" "mailcc.serverdomain.com";
    <?php endforeach; ?>
 
Last edited by a moderator:
Many thanks, now it works :)

Actually, you should use

You mean that there will soon be changes?
If I have read it correctly then it may be possible in the future to be able to secure webmail.domain.com by let`s encrypt.
Then the code will surely change again and my custom templates no longer work?
 
Hi moswak,

pls. have a look at => #25 for a ( maybe temporary ) solution how to secure the "webmail.*" - domains on your server with the Plesk - Let's Encrypt - extension.

You mean that there will soon be changes?
Then the code will surely change again and my custom templates no longer work?
I expect changes for the Plesk - Let's Encrypt - extension, yes and I expect them in the near future, because this extension is very popular and "doesn't work as expected right now in Plesk Onyx" ( as you can see in quite a few threads/post in the forum ). I'm pretty sure, that the Plesk developers will implement something similar, as the work-around in my above mentioned link. ;)
 
Back
Top