Public IMAP Folder don't show moved messages

Use this forum if you have installed hMailServer and want to ask a question related to a production release of hMailServer. Before posting, please read the troubleshooting guide. A large part of all reported issues are already described in detail here.
Post Reply
User avatar
katip
Senior user
Senior user
Posts: 673
Joined: 2006-12-22 07:58
Location: Istanbul

Public IMAP Folder don't show moved messages

Post by katip » 2019-04-10 11:06

Untitled 2.png
after so many happy years with HMS it may sound strange but i'm using Public IMAP folder for the first time to move there certain messages by account rules.
image shows how it's setup looks like. ("Anyone" has only "Insert" permission, admin "full".)

however #public.Discarded folder (under admin account on client) shows almost no messages. at first, only a few from about 50 moved messages arrived there and i was wondering why not more. restarted service, suddenly all were there, but again no updates since restart.

i tried TB, ClawsMail, Sylpheed, mobile phone, webmail... no avail. it's not a client problem.

on file system, #public folder is placed in <HMS>\data folder and all moved messages are placed in their folders under #public folder. i.e. messages exist on file system at right place.

i'm sure i do something basic wrong, probably on server, but what. thanks for any advise.
Katip
--
HMS 5.7.0-B2428-LTS-64-bit, MySQL 5.7.24, SA 3.4.2, ClamAV 0.101.2 + SaneS

User avatar
katip
Senior user
Senior user
Posts: 673
Joined: 2006-12-22 07:58
Location: Istanbul

Re: Public IMAP Folder don't show moved messages

Post by katip » 2019-04-10 23:02

disappointing..
literally i cannot get a basic feature in HMS working :o
tried everything. deleted folder, recreated again. restarted service, renamed, restarted again etc.. everytime the same result. initially first 2-3 mails appear in client, then nothing more. after a restart, all meanwhile moved messages appear at once, then again nothing new until next restart.

on file system all looks fine. <HMS>\data\#public folder and usual subfolders and message files in folders, everything as expected. but no result on client side.
i'm clueless. any advise or should i give up? does this work at all? :P
Katip
--
HMS 5.7.0-B2428-LTS-64-bit, MySQL 5.7.24, SA 3.4.2, ClamAV 0.101.2 + SaneS

User avatar
mattg
Moderator
Moderator
Posts: 20010
Joined: 2007-06-14 05:12
Location: 'The Outback' Australia

Re: Public IMAP Folder don't show moved messages

Post by mattg » 2019-04-11 12:23

I have similar trouble with some text only messages - they just don't show in a mail client


My text messages are all auto generated on remote servers, and I check the message content for specific text.
These are logs and I look for words like 'error' in the text, I also check dates of log entries etc.

Anyway I found that I need to do something like this in a function called from a global rule to get the messages to show up in mail clients

Code: Select all

	if left(oMessage.body,15) = "***************" then 
		oMessage.body = "********** Problem found **************" & vbcrlf & oMessage.body
		oMessage.addRecipient sRecipientName,sRecipientAddress
	else
		oMessage.body = "All checked OK" & vbcrlf & oMessage.body
		oMessage.addRecipient sRecipientName,sRecipientAddress1
	end if
	oMessage.Save

I never could work out what caused this
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

User avatar
SorenR
Senior user
Senior user
Posts: 3169
Joined: 2006-08-21 15:38
Location: Denmark

Re: Public IMAP Folder don't show moved messages

Post by SorenR » 2019-04-11 14:08

Doing some testing on this...

My SPAM account move emails around based on triggers so had to add a "forward to mirror@acme.inc" - this IS the actual account :mrgreen:

"mirror@acme.inc" got rules based on triggers to move mail into one of five public folders; "#Public\Inbox_", "#Public\UCE - SPAM", "#Public\UCE - Tagged as Spam", "#Public\UCE - Rule" and "#Public\UCE - HighScore".
Triggers are the same as for my SPAM account so content should also be the same at the end of the day.

@acme.inc, @looney.tunes and the characters that follow those are my test subjects 8)

Just like Synology Surveillance Station is installed on my NAS ... Named: BigBrother :mrgreen:
SørenR.

The quantum rule of insecurity which states that the act of observing how vulnerable a host or service is changes the insecurity level of the service.

User avatar
katip
Senior user
Senior user
Posts: 673
Joined: 2006-12-22 07:58
Location: Istanbul

Re: Public IMAP Folder don't show moved messages

Post by katip » 2019-04-11 16:23

my setup is slightly different. you know my concern about double, triple... receipts. after some scripting as i told before i sorted this out with 100% accuracy.
now, in fact i don't need this mails which are marked such as "X-HMS-Discarded" and forward & delete them to a trash account. but just to monitor the flow for a few days till i'm 100% sure that all is running smooth, moving discarded messages to a public IMAP folder came to my mind. "Anyone" should have "Insert" right only, admin shuld have full access. as admin i (was hoping to) monitor, copy, delete... discarded messages. unfortunately i get only a few messages on client then it stops. filesystem has them all properly placed. after a service restart all appear in client, then again nothing more..

i give up. i'll open a trash account and move discarded messages there for monitoring. actually i don't need a "public" thing. i just wanted to have an experience with public folders. alas, nothing pleasant to remember :?
thanks anyway.
Katip
--
HMS 5.7.0-B2428-LTS-64-bit, MySQL 5.7.24, SA 3.4.2, ClamAV 0.101.2 + SaneS

User avatar
SorenR
Senior user
Senior user
Posts: 3169
Joined: 2006-08-21 15:38
Location: Denmark

Re: Public IMAP Folder don't show moved messages

Post by SorenR » 2019-04-11 16:31

Dene ve başarısız ol ama asla denemede başarısız olma!
SørenR.

The quantum rule of insecurity which states that the act of observing how vulnerable a host or service is changes the insecurity level of the service.

User avatar
katip
Senior user
Senior user
Posts: 673
Joined: 2006-12-22 07:58
Location: Istanbul

Re: Public IMAP Folder don't show moved messages

Post by katip » 2019-04-11 16:40

SorenR wrote:
2019-04-11 16:31
Dene ve başarısız ol ama asla denemede başarısız olma!
war ja am Probieren seit 2 Tagen, hab' die Schnauze voll :D
(couldn't trust Google to translate it in Danish, but your's is perfect!)
Katip
--
HMS 5.7.0-B2428-LTS-64-bit, MySQL 5.7.24, SA 3.4.2, ClamAV 0.101.2 + SaneS

User avatar
katip
Senior user
Senior user
Posts: 673
Joined: 2006-12-22 07:58
Location: Istanbul

Re: Public IMAP Folder don't show moved messages

Post by katip » 2019-04-11 16:46

mattg wrote:
2019-04-11 12:23
I have similar trouble with some text only messages - they just don't show in a mail client


My text messages are all auto generated on remote servers, and I check the message content for specific text.
These are logs and I look for words like 'error' in the text, I also check dates of log entries etc.

Anyway I found that I need to do something like this in a function called from a global rule to get the messages to show up in mail clients

Code: Select all

	if left(oMessage.body,15) = "***************" then 
		oMessage.body = "********** Problem found **************" & vbcrlf & oMessage.body
		oMessage.addRecipient sRecipientName,sRecipientAddress
	else
		oMessage.body = "All checked OK" & vbcrlf & oMessage.body
		oMessage.addRecipient sRecipientName,sRecipientAddress1
	end if
	oMessage.Save

I never could work out what caused this
also strange.
but my messages have nothing special. no difference between those few which appear in client and those don't.
Katip
--
HMS 5.7.0-B2428-LTS-64-bit, MySQL 5.7.24, SA 3.4.2, ClamAV 0.101.2 + SaneS

User avatar
SorenR
Senior user
Senior user
Posts: 3169
Joined: 2006-08-21 15:38
Location: Denmark

Re: Public IMAP Folder don't show moved messages

Post by SorenR » 2019-04-11 18:52

katip wrote:
2019-04-11 16:40
SorenR wrote:
2019-04-11 16:31
Dene ve başarısız ol ama asla denemede başarısız olma!
war ja am Probieren seit 2 Tagen, hab' die Schnauze voll :D
(couldn't trust Google to translate it in Danish, but your's is perfect!)
Brother-in-law's ex-wife is turkish. She's got a new husband in UK, but we still get together all of us every few years or so for xmas and birthdays.
SørenR.

The quantum rule of insecurity which states that the act of observing how vulnerable a host or service is changes the insecurity level of the service.

User avatar
katip
Senior user
Senior user
Posts: 673
Joined: 2006-12-22 07:58
Location: Istanbul

Re: Public IMAP Folder don't show moved messages

Post by katip » 2019-04-11 19:58

SorenR wrote:
2019-04-11 18:52
Brother-in-law's ex-wife is turkish. She's got a new husband in UK, but we still get together all of us every few years or so for xmas and birthdays.
that's a good thing. greetings..
Katip
--
HMS 5.7.0-B2428-LTS-64-bit, MySQL 5.7.24, SA 3.4.2, ClamAV 0.101.2 + SaneS

User avatar
SorenR
Senior user
Senior user
Posts: 3169
Joined: 2006-08-21 15:38
Location: Denmark

Re: Public IMAP Folder don't show moved messages

Post by SorenR » 2019-04-11 22:33

SorenR wrote:
2019-04-11 14:08
Doing some testing on this...

My SPAM account move emails around based on triggers so had to add a "forward to mirror@acme.inc" - this IS the actual account :mrgreen:

bla bla bla
OK, I have received 3 (three) SPAM mails in 8 hours ... NO I don't need you guys to send me some but this is typical me. Whenever I am testing stuff with live data ... I don't get none. Figures. :roll:
SørenR.

The quantum rule of insecurity which states that the act of observing how vulnerable a host or service is changes the insecurity level of the service.

User avatar
katip
Senior user
Senior user
Posts: 673
Joined: 2006-12-22 07:58
Location: Istanbul

Re: Public IMAP Folder don't show moved messages

Post by katip » 2019-04-17 19:52

i came across to this :
https://www.hmailserver.com/documentati ... ce_scripts

i was hoping it might help to fix this issue about messages don't showing up. according to explanation text it should be the right medicine.
but it throws an error when it comes to "Call obApp.Utilities.PerformMaintenance(1)"
source is here and i don't understand much:
https://github.com/hmailserver/hmailser ... lities.cpp
any advise?
Untitled 1.png
Untitled 1.png (5.98 KiB) Viewed 1450 times
Katip
--
HMS 5.7.0-B2428-LTS-64-bit, MySQL 5.7.24, SA 3.4.2, ClamAV 0.101.2 + SaneS

User avatar
SorenR
Senior user
Senior user
Posts: 3169
Joined: 2006-08-21 15:38
Location: Denmark

Re: Public IMAP Folder don't show moved messages

Post by SorenR » 2019-04-17 23:15

The short version (NOT to be performed by hand!):

Code: Select all

// Goes through all mailboxes and sets the foldercurrentuid to the latest message uid.

SELECT messagefolderid, MAX(messageuid) as messageuid FROM hm_messages GROUP BY messagefolderid;

Calculate messageFolderID as 64 bit integer based on field messagefolderid from the DB.
Calculate messageUID as 64 bit integer based on field messageuid from the DB.

UPDATE hm_imapfolders SET foldercurrentuid = {0} WHERE folderid = {1} AND foldercurrentuid < {0}", messageUID, messageFolderID);
What does hMailServer log show?

Can you post your "hms_maintenance.vbs" code?
SørenR.

The quantum rule of insecurity which states that the act of observing how vulnerable a host or service is changes the insecurity level of the service.

User avatar
katip
Senior user
Senior user
Posts: 673
Joined: 2006-12-22 07:58
Location: Istanbul

Re: Public IMAP Folder don't show moved messages

Post by katip » 2019-04-18 05:27

SorenR wrote:
2019-04-17 23:15
What does hMailServer log show?

Can you post your "hms_maintenance.vbs" code?
turned on app log, but it shows nothing. only this:

Code: Select all

"APPLICATION"	3200	"2019-04-17 20:14:15.591"	"Stopping servers..."
HMS enters in Pause mode and error message pops up.

code is simply copy/paste from the page (except password of course):

Code: Select all

Dim obApp
   Set obApp = CreateObject("hMailServer.Application")
    
   Call obApp.Authenticate("Administrator", "<password>")
   Call obApp.Stop()
   Call obApp.Utilities.PerformMaintenance(1)
   Call obApp.Start()

   MsgBox "Done"
Katip
--
HMS 5.7.0-B2428-LTS-64-bit, MySQL 5.7.24, SA 3.4.2, ClamAV 0.101.2 + SaneS

User avatar
jimimaseye
Moderator
Moderator
Posts: 8082
Joined: 2011-09-08 17:48

Re: Public IMAP Folder don't show moved messages

Post by jimimaseye » 2019-04-18 08:50

Presumably you changed the PASSWORD in your script and didnt leave it as "<password>"? (Stupid question but even so....)

(I tried the script and it ran without error. What it did, I have no idea but it did run without error.)
"APPLICATION" 8200 "2019-04-18 07:48:49.095" "Stopping servers..."
"APPLICATION" 8200 "2019-04-18 07:48:51.253" "Servers stopped."
"APPLICATION" 8200 "2019-04-18 07:48:51.845" "Starting servers..."
"APPLICATION" 8200 "2019-04-18 07:48:52.128" "Servers started."
HMS 5.6.6 B2383 on Win Server 2008 R2 Foundation, + 5.6.7-B2415 on test.
SpamassassinForWindows 3.4.0 spamd service
AV: Clamwin + Clamd service + sanesecurity defs : https://www.hmailserver.com/forum/viewtopic.php?f=21&t=26829

User avatar
katip
Senior user
Senior user
Posts: 673
Joined: 2006-12-22 07:58
Location: Istanbul

Re: Public IMAP Folder don't show moved messages

Post by katip » 2019-04-18 09:23

jimimaseye wrote:
2019-04-18 08:50
Presumably you changed the PASSWORD in your script and didnt leave it as "<password>"? (Stupid question but even so....)
yes sure. copy/paste, just changed the password.

it works too without any error on my home setup (Dravion's x64 build + MySQL x64).
but on office setup (latest HMS + 32 bit MySQL) it returns this error.

i tried to call the script with c:\Windows\SysWOW64\wscript.exe as well but nothing changes.

BTW, this issue was supposedly addressed 10 years ago:
Version 5.3.1 - Build 1680 (2009-11-04)
Issue 267: hMailServer sometimes generated invalid message UIDs. This could have the effect that new messages did not show up in folders. The problem occurred if a rule executed a script function which saved a message, and another rule moved the same message after that. This fix prevents the problem from occurring again. To repair the problem in the database, run the Reset folder UIDs maintenance script, located here: http://www.hmailserver.com/documentatio ... ce_scripts
this exactly describes my problem. function adds a header and saves the message, after that another rule moves it to public folder - unfortunately almost all invisible in client.
again, this doesn't occure on my home setup, but on the other one at office. :x
Katip
--
HMS 5.7.0-B2428-LTS-64-bit, MySQL 5.7.24, SA 3.4.2, ClamAV 0.101.2 + SaneS

Post Reply