Custom URL for Webmail


$ rm -rf /usr/local/CyberCP/public/snappymail
$ rm -rf /usr/local/lscp/cyberpanel/rainloop/data/_data_/_default_/configs

# run the rest if you want to personalize (not recommended for beginners)

$ wget
$ unzip -d /usr/local/CyberCP/public/snappymail
$ cd /usr/local/CyberCP/public/snappymail
$ find . -type d -exec chmod 755 {} \;
$ find . -type f -exec chmod 644 {} \;
$ mkdir -p /usr/local/lscp/cyberpanel/rainloop/data
$ mkdir -p /usr/local/lscp/cyberpanel/rainloop/data/_data_/_default_/configs/
$ mkdir snappymail configs
$ cat << EOF >> /usr/local/lscp/cyberpanel/rainloop/data/_data_/_default_/configs/application.ini
imap_folder_list_limit = 0
autocreate_system_folders = On
$ cat << EOF >> /usr/local/CyberCP/public/snappymail/snappymail/v/2.17.0/include.php
$sCustomDataPath = '/usr/local/lscp/cyberpanel/rainloop/data';
# you will need to comment out any other $sCustomDataPath = before the one we appended above
$ cat << EOF >> /usr/local/CyberCP/public/snappymail/_include.php
define('APP_DATA_FOLDER_PATH', '/usr/local/lscp/cyberpanel/rainloop/data/');
$ cat << EOF >> /usr/local/CyberCP/public/snappymail/include.php
define('APP_DATA_FOLDER_PATH', '/usr/local/lscp/cyberpanel/rainloop/data/');
$ mkdir snappymail configs
$ sed -i 's|autocreate_system_folders = Off|autocreate_system_folders = On|g' 2.17.0

Followed your direction with Cyberpanel upgrade. Results = same error after upgrade.

Then I tried manual process following you steps
and getting the errors at the end

root@trahezy:/usr/local/CyberCP/public/snappymail# mkdir snappymail configs
mkdir: cannot create directory ‘snappymail’: File exists
mkdir: cannot create directory ‘configs’: File exists
root@trahezy:/usr/local/CyberCP/public/snappymail# sed -i ‘s|autocreate_system_folders = Off|autocreate_system_folders = On|g’ 2.17.0
sed: can’t read 2.17.0: No such file or directory

I switched into the directory v where 2.17.0 directory is located and got this
root@trahezy:/usr/local/CyberCP/public/snappymail/snappymail/v# sed -i ‘s|autocreate_system_folders = Off|autocreate_system_folders = On|g’ 2.17.0
sed: couldn’t edit 2.17.0: not a regular file

Did you remove the previous snappymail installation v2.18.6 as i advised above?

Yes. I did. I just repeated again the process and after cyberpanel upgrade. i did snappymail version change to 2.17.0.
Got same error

Have you seen this Error 500 on

No. Not really getting that error.
Accessing the snappymail through cybepanel domain/snappymail works but using its dedicated subdomain is the issue

cyberpaneldomaincom/snappymail = working
maildomaincom = the error


Rewrite Rules Added by CyberPanel Rewrite Rule Generator

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.(.)$
RewriteRule ^(.
)$ http://%1/$1 [L,R=301]
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.) https://%{SERVER_NAME}/$1 [R,L]
RewriteRule ^(.
)$ https://cyberpanel/snappymail/$1 [P]

End CyberPanel Generated Rules.

SHould not work since cyberpanel creates or any other panel create a mailserver from that domain. You need to add something like

If you look at the post you will see he/she ran into this issue:

Doesn’t work with webmaildomaincom that was just example.
Try to do clean install of cyberpanel and do the webmaildomaincom to reproduce the issue.

by the way
Even though the maildomaincom is used by mailserver ports for webserver are not on mailserver so web access to the maildomaincom should work fine without issue. Just a highlight.

Refreshed and cleared cache and tried a new browser all go back to same error

Are you in a position to reinstall your server os and start over? If so share your server os type and version

Good evening, I don’t know if you are still interested, but to do the proxy correctly I solved it this way. I hope it can be the help to someone!

### [PROXY] Snappymail
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/snappymail
REWRITERULE ^(.*)$ https://cyberpanel/snappymail/$1 [P,L,]
RewriteCond %{REQUEST_URI} ^/snappymail
REWRITERULE ^(.*)$ https://cyberpanel/$1 [P,L,] should be replaced with the correct host.


Already installed like 5 times ending up with the same results.

Thanks for your contribution,

Your configuration works super smooth.

Thanks mate.

You all be blessed.

I am very pleased! Always at your disposal. :grinning:

Where i put this code?

This is for each domain?

Hey, Thanks for the input. It works flawlessly. Although after doing this I can’t login through webmail anymore. i am getting error “Server message: Cannot enable STARTTLS.”

Any Idea how to resolve this?

Heya, i am very very new to CyberPanel and still havent figured out most things, i would like to know how exactly i can change the login for the webmain, i have bought my domain through CF and i dont have a problem with the CyberPanel login being ip:port, but since i am offering webmail access to my friends and them having to go to ip:port/snappymail isnt that great for them since their home network has strict rules and they cannot connect to plain IP adresses, i would like to know how i can change the snappymail login thing to webmail.mydomain.tld, i have tried nearly everything that was suggested in the replys above but nothing has worked, thanks in advance for taking your time to help a noobie out

@KingMac , Amazing Tip. Work Just Fine!!!


1 Like

amazing work bro!!! i just came back to this thread and wow . love your solution!

I don’t think is this a problem with the proxy kingmac wrote. this is probably due to your mail ssl . either way to help others perhaps click solution on kingmac’s answer , so that others can find this solution quick!

1 Like