Custom URL for Webmail

wait you updated snappymail? so if i run this version update on the server it should work?

Welcome @Murex Happy you are here

if you do not have any technical ability I do not advice you upgrade snappymail if it works perfectly with standard cyberpanel installation.

The upgrade will not cause any issues unless there are unknown issues with latest release. Also I advice my clients not use any latest releases of any software for production.

hello, i’m getting the same issues the OP, and trying to solve it , so far only webmailDOTdomainDOTcom/snappymail redirects properly and i’m trying to remove that last bit , tried another redirect from webmail.domain.com to webmailDOTdomainDOTcom/snappymail
and forsome strange reason it will not work! so i was wondering if this is only because the cyberpanel version of snappy has an issue .

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
CyberpanelDOTserverdomainDOTcom/snappymail/
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} ^webmail.domainname.com$
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

1 Like

My friend this part will redirect to admin panel:

RewriteCond %{HTTP_HOST} ^webmail.domainname.com$
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 . webmail.domainname.com is redirecting to https webmail domainname com / snappymail

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

and so it takes you to webmail.domainname.com/snappymail
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 mydomain.com/snappymail. is there any way to keep the 301 rule and keep the address in the address bar to webmail.domain.com

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:192.168.15.254][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] https://mail.mydomain.com/snappymail/
[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:192.168.15.254][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] https://mail.mydomain.com/snappymail/?/AppData/0/17282663328686265/
[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

Run

sh <(curl https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh || wget -O - https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh)

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

sudo su - -c "sh <(curl https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh || wget -O - https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh)"

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

Run

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

# RUN CYBERPANEL UPGRADE AS IT WILL DO EVERYTHING FOR YOU
# run the rest if you want to personalize (not recommended for beginners)

$ wget https://github.com/the-djmaze/snappymail/releases/download/v2.17.0/snappymail-2.17.0.zip
$ unzip snappymail-2.17.0.zip -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
[labs]
imap_folder_list_limit = 0
autocreate_system_folders = On
EOF
$ cat << EOF >> /usr/local/CyberCP/public/snappymail/snappymail/v/2.17.0/include.php
$sCustomDataPath = '/usr/local/lscp/cyberpanel/rainloop/data';
EOF
# 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/');
EOF
$ cat << EOF >> /usr/local/CyberCP/public/snappymail/include.php
define('APP_DATA_FOLDER_PATH', '/usr/local/lscp/cyberpanel/rainloop/data/');
EOF
$ 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 webmail.example1.net