Custom URL for Webmail

CyberPanel’s version of snappymail is downloaded straight from the source during installation and it is not a modified version or anything.

I recommend that you guys don’t try to reverse proxy snappymail.

1 Like

I figured it out . after looking into the log I realized that the redirect link keeps going into snappymail/snappymail which is creating all the problems , the solution was editing the intial redirect to https to add /snappymail , like that .

RewriteRule ^/?(.*) https://%{SERVER_NAME}/snappymail/$1 [R,L]

so when the Proxy is taking the server name it applies snappymail right away hence
RewriteRule ^(.*)$ HTTP://cyberpanel/$1 [P]

this way it works and logs in
hope it helps the others.

@Murex no that would not work. See this

This should work. This is the solution.

Thanks a lot for your time! i’ve never seen such awesome support and community before!

your solution works like a redirect. basically people will put their mail. address and then get redirected to the cyberpanel main address with snappy
meaning if they put mailDOTdomainDOTcom they will see on the address bar
which is not the intended outcome.
i was thinking of setting up another proxy to mask the cyberpanel main domain page . however the solution i provided earlier is satisfying , i dont want the server domain to show up.
thats why i’m still using the proxy that was set up to cover the 8090 port

@Murex post your rewrite rules I revert if it works as intended

hello again, thanks again for all your help

so i set up the rewrite rules as so

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

RewriteCond %{HTTP_HOST} ^$
RewriteRule ^(.*)$ HTTP://cyberpanel/$1 [P]

keep in mind that the above code handles everything, because I changed the rewrite code from cyber panel
these ones

Rewrite Rules Added by CyberPanel Rewrite Rule Generator

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]

End CyberPanel Generated Rules.

keep in mind that I followed this tutorial before remove port 8090

My friend this part will redirect to admin panel:

RewriteCond %{HTTP_HOST} ^$
RewriteRule ^(.*)$ HTTP://cyberpanel/$1 [P]

it wont because i already kept snappymail in the original redirect .here
RewriteRule ^/?(.*) https://%{SERVER_NAME}/snappymail/$1 [R,L]

so . is redirecting to https webmail domainname com / snappymail

then its checks http_host for and proxy it with the cyberpanelproxy which we set up server side

and so it takes you to
its working as intended … i’m using it as we speak

Hey, I followed the tutorial you linked here. it works. but at the end of the day, redirects your address bar url to is there any way to keep the 301 rule and keep the address in the address bar to

Here is the log that shows this error…

[2022-12-19 19:34:25.660][af79299e] INFO[DATA]: [DATE:2022-12-19 UTC][SM:2.15.3][IP:][PID:92997][LiteSpeed][litespeed][Streams:tcp,udp,unix,udg,ssl,tls,tlsv1.0,tlsv1.1,tlsv1.2,tlsv1.3]
[2022-12-19 19:34:25.660][af79299e] REQUEST[NOTE]: [GET]
[2022-12-19 19:34:25.689][af79299e] INFO[MEMORY]: Memory peak usage: 2MB
[2022-12-19 19:34:25.689][af79299e] INFO[TIME]: Time delta: 0.07535195350647

[2022-12-19 19:34:27.169][b0f025b2] INFO[DATA]: [DATE:2022-12-19 UTC][SM:2.15.3][IP:][PID:92997][LiteSpeed][litespeed][Streams:tcp,udp,unix,udg,ssl,tls,tlsv1.0,tlsv1.1,tlsv1.2,tlsv1.3]
[2022-12-19 19:34:27.169][b0f025b2] REQUEST[NOTE]: [GET]
[2022-12-19 19:34:27.171][b0f025b2] APPDATA[DATA]: rl.initData({“Auth”:false,“AccountHash”:“”,“AccountSignMe”:false,“MailToEmail”:“”,“Email”:“”,“DevEmail”:“”,“DevPassword”:“”,“Title”:“SnappyMail Webmail”,“LoadingDescription”:“SnappyMail”,“FaviconUrl”:“”,“LoginDefaultDomain”:“”,“hideSubmitButton”:false,“DetermineUserLanguage”:true,“DetermineUserDomain”:true,“SieveAllowFileintoInbox”:false,“ContactsIsAllowed”:false,“Admin”:,“Capa”:,“Plugins”:,“System”:{“version”:“2.15.3”,“admin”:false,“token”:“ae193d0888b7f9a0aebe8aa0abff51f46d6ccfd4”,“inIframe”:false,“allowHtmlEditorBitiButtons”:false,“allowCtrlEnterOnCompose”:true,“useImapThread”:true,“allowAppendMessage”:false,“folderSpecLimit”:50,“listPermanentFiltered”:false,“themes”:[“Default”,“A”,“Blurred”,“DarkShine”,“Linen”,“Love”,“Snow”,“SnowDarkV1”,“Squares”,“SquaresDark”,“Stripes”,“Wood”,“Xv”,“Clear”],“languages”:[“ar-SA”,“bg-BG”,“cs-CZ”,“da-DK”,“de-DE”,“el-GR”,“en”,“en-US”,“es-ES”,“et-EE”,“fa-IR”,“fi-FI”,“fr-FR”,“hu-HU”,“id-ID”,“is-IS”,“it-IT”,“ja-JP”,“ko-KR”,“lt-LT”,“lv-LV”,“nb-NO”,“nl-NL”,“pl-PL”,“pt-BR”,“pt-PT”,“ro-RO”,“ru-RU”,“sk-SK”,“sl-SI”,“sv-SE”,“tr-TR”,“uk-UA”,“zh-CN”,“zh-TW”],“languagesAdmin”:[“cs-CZ”,“da-DK”,“de-DE”,“en”,“es-ES”,“fa-IR”,“fi-FI”,“fr-FR”,“hu-HU”,“id-ID”,“it-IT”,“ja-JP”,“lt-LT”,“nb-NO”,“nl-NL”,“pl-PL”,“pt-BR”,“ru-RU”,“sk-SK”,“sl-SI”,“sv-SE”,“zh-CN”],“attachmentsActions”:[“zip”],“customLogoutLink”:“”},“NewMoveToFolder”:true,“AllowLanguagesOnSettings”:true,“AllowLanguagesOnLogin”:true,“AttachmentLimit”:2097152,“SignMe”:“DefaultOff”,“UseLocalProxyForExternalImages”:true,“ViewHTML”:true,“ShowImages”:false,“RemoveColors”:false,“MessagesPerPage”:20,“MessageReadDelay”:5,“SoundNotification”:true,“NotificationSound”:“new-mail”,“DesktopNotifications”:true,“Layout”:1,“EditorDefaultType”:“Html”,“UseCheckboxesInList”:true,“AutoLogout”:30,“UseThreads”:false,“AllowDraftAutosave”:true,“ReplySameFolder”:false,“ContactsAutosave”:true,“HideUnsubscribed”:false,“MainEmail”:“”,“KolabContactFolder”:“”,“UserBackgroundName”:“”,“UserBackgroundHash”:“”,“AdditionalLoginError”:“”,“Theme”:“Default”,“Language”:“en-US”,“UserLanguage”:“en-US”,“PluginsLink”:“”,“StaticLibsJs”:“/snappymail/snappymail/v/2.15.3/static/js/min/libs.min.js”});
[2022-12-19 19:34:27.171][b0f025b2] INFO[MEMORY]: Memory peak usage: 2MB
[2022-12-19 19:34:27.171][b0f025b2] INFO[TIME]: Time delta: 0.0051159858703613

Welcome @saidearly Happy you are here


sh <(curl || wget -O -

If using a sudo user rather than root, try this:

sudo su - -c "sh <(curl || wget -O -"

Already on the latest release. I have even done fresh installation couple times. But the error is the same.


$ 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.