Severity: 3 (Medium), Code: HM5025, Source: PersistentMessage

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
VadaDosaIdly
New user
New user
Posts: 18
Joined: 2020-05-26 16:03

Severity: 3 (Medium), Code: HM5025, Source: PersistentMessage

Post by VadaDosaIdly » 2020-05-30 20:15

"ERROR" 4872 "2020-05-27 10:18:24.699" "Severity: 3 (Medium), Code: HM5025, Source: PersistentMessage::ReadObject, Description: The message 12437 in mailbox 121 in account 56 has no UID set."
This message is listed in Error file in hMailServer logs folder.
What is it means? :roll: How to fix it? :?:

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

Re: Severity: 3 (Medium), Code: HM5025, Source: PersistentMessage

Post by mattg » 2020-05-30 22:57

How was the message added to hmailserver?
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
VadaDosaIdly
New user
New user
Posts: 18
Joined: 2020-05-26 16:03

Re: Severity: 3 (Medium), Code: HM5025, Source: PersistentMessage

Post by VadaDosaIdly » 2020-06-02 20:17

Good question.
Let me give background. We use standard mail clients (Outllok client software, MS Mail for windows 10) and our own webbased client. Webbased client uses Mail.SmtpClient object to send mail and after successfully sending email it adds message in hm_messages table using sql insert statement. sql statement adds following values in the row along with message file name and other information.

messagecurnooftries=8, messagenexttrytime=’1901-01-01 00:00:00.000’, messageflags=8, messagelocked=1, messageuid=0
Above values are constant and inserted in table to all sent messages.

I think this error messages are coming when our own webbased client sents message and adds into table. We do not know the logic behind generating messageuid. Can you provide logic in detremining messageuid.

Also, please advice if there is any other method available so hmailserver object would automatically add sent messages in table rather using sql statement that we used in client software.

palinka
Senior user
Senior user
Posts: 1942
Joined: 2017-09-12 17:57

Re: Severity: 3 (Medium), Code: HM5025, Source: PersistentMessage

Post by palinka » 2020-06-02 23:32

VadaDosaIdly wrote:
2020-06-02 20:17

Also, please advice if there is any other method available so hmailserver object would automatically add sent messages in table rather using sql statement that we used in client software.
Instead of messing with the database, use a rule to copy the message to the user's sent box. I'm not 100% sure how you would set up the rule. Ideally it would be if from contains <@yourdomain.com> AND IP = 127.0.0.1 then copy message to imap folder Sent. I'm not sure about the IP part and I'm on my phone so I can't look for the best option. But you get the idea. It could be some other criteria like mua header or something else unique about your webmail.

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

Re: Severity: 3 (Medium), Code: HM5025, Source: PersistentMessage

Post by mattg » 2020-06-03 03:03

VadaDosaIdly wrote:
2020-06-02 20:17
... adds message in hm_messages table using sql insert statement.
That right there is your problem

You either need to use a rule as Palinka has suggested, or use the published API to add a message, or use standard IMAP connections to achieve 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
VadaDosaIdly
New user
New user
Posts: 18
Joined: 2020-05-26 16:03

Re: Severity: 3 (Medium), Code: HM5025, Source: PersistentMessage

Post by VadaDosaIdly » 2020-06-03 05:08

Hi mattg,
use the published API to add a message, or use standard IMAP connections to achieve this.
What APIs are available for hMailServer component and how to use it for sending email? Please explain with sample code.


Hi palinka,

Bit confused by your suggestion. As mentioned earlier, our Web-based client calls Mail.SmtpClient.Send() method to send mail. This does not save email in database. I guess this is reason sql insert statement is used to insert sent message and its information in table. So far our customized web-based client is receiving and sending emails. My only concerned was how to stop plenty of following similar errors on various mailboxes.
ERROR" 4872 "2020-05-27 10:18:24.699" "Severity: 3 (Medium), Code: HM5025, Source: PersistentMessage::ReadObject, Description: The message 12437 in mailbox 121 in account 56 has no UID set."

palinka
Senior user
Senior user
Posts: 1942
Joined: 2017-09-12 17:57

Re: Severity: 3 (Medium), Code: HM5025, Source: PersistentMessage

Post by palinka » 2020-06-03 12:27

I'm pretty sure no message that hmailserver or any mail server delivered gets saved. Clients save messages. For example, every message you send via imap connected client gets processed twice: once when you send and then when your client adds a saved copy to the sent folder.

If you want to save the message then either your webmail needs to place a copy in the sent folder, or use rules to create a copy, or script it within hmailserver.

Look at the documentation for the API. But I think using rules is the simplest way.

You also might want to search the forum for examples. I'm sure you're not the first person ever to have this need. :D

palinka
Senior user
Senior user
Posts: 1942
Joined: 2017-09-12 17:57

Re: Severity: 3 (Medium), Code: HM5025, Source: PersistentMessage

Post by palinka » 2020-06-03 12:32

VadaDosaIdly wrote:
2020-06-03 05:08
My only concerned was how to stop plenty of following similar errors on various mailboxes.
ERROR" 4872 "2020-05-27 10:18:24.699" "Severity: 3 (Medium), Code: HM5025, Source: PersistentMessage::ReadObject, Description: The message 12437 in mailbox 121 in account 56 has no UID set."
UID and message ID are not the same. I don't know how you can fix this now other than finding and deleting these messages from the database. Is there an eml file stored in the data folder for this message? I'm guessing no.

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

Re: Severity: 3 (Medium), Code: HM5025, Source: PersistentMessage

Post by jimimaseye » 2020-06-03 13:45

messagecurnooftries=8, messagenexttrytime=’1901-01-01 00:00:00.000’, messageflags=8, messagelocked=1, messageuid=0
And thats the problem and why we tell people not to mess with the database directly.

Try interrogating your message table for message with uid=0 and delete the records. Then run dds if required. (Backup first).

In the end you are on your own with this. It is not caused by software and normal usage (on what we can guide you through) is not the cause. You have corrupted the database by own actions and will need to unpick the damage bit by bit (and that starts by stopping sql inserting in to the database).

[Entered by mobile. Excuse my spelling.]
5.7 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
VadaDosaIdly
New user
New user
Posts: 18
Joined: 2020-05-26 16:03

Re: Severity: 3 (Medium), Code: HM5025, Source: PersistentMessage

Post by VadaDosaIdly » 2020-06-03 15:05

Hi palinka,

UID and message ID are not same. That is right. I am referring to messageuid and I guess UID and messageuid could be same.
Is there an eml file stored in the data folder for this message?
Yes, customized web-based software creates eml file and saves in the respective folder of the domain email account.

User avatar
VadaDosaIdly
New user
New user
Posts: 18
Joined: 2020-05-26 16:03

Re: Severity: 3 (Medium), Code: HM5025, Source: PersistentMessage

Post by VadaDosaIdly » 2020-06-03 15:16

Everyone is giving half information and it is not helping anyways. I know it is the problem.
I am requesting if someone can explain steps to send email using API or other method so it would generate eml file and add a record into database.

palinka
Senior user
Senior user
Posts: 1942
Joined: 2017-09-12 17:57

Re: Severity: 3 (Medium), Code: HM5025, Source: PersistentMessage

Post by palinka » 2020-06-03 17:49

VadaDosaIdly wrote:
2020-06-03 15:16
Everyone is giving half information and it is not helping anyways. I know it is the problem.
I am requesting if someone can explain steps to send email using API or other method so it would generate eml file and add a record into database.
Try interrogating your message table for message with uid=0 and delete the records. Then run dds if required. (Backup first).
Look at the documentation for the API. But I think using rules is the simplest way.

You also might want to search the forum for examples. I'm sure you're not the first person ever to have this need. :D
Instead of messing with the database, use a rule to copy the message to the user's sent box. I'm not 100% sure how you would set up the rule. Ideally it would be if from contains <@yourdomain.com> AND IP = 127.0.0.1 then copy message to imap folder Sent. I'm not sure about the IP part and I'm on my phone so I can't look for the best option. But you get the idea. It could be some other criteria like mua header or something else unique about your webmail.
Jimi's right. There's not much we can do. First, you have to stop the bleeding: Stop inserting gibberish into the database and delete the broken entries. Next, if you have eml files, you can run the data directory synchronizer to add those messages to the database. They will appear in the inbox, so then you will have to manually find them and move them to the sent folder if that's what you want.

Lastly, there are many MANY tutorials here for the API, plus there is the documentation. There is a very clear example in the documentation as well on how to send a message using the COM API (it won't help you put a copy in the sent folder, which is your real underlying issue).

However, as I said earlier, this can probably be achieved more easily by creating a rule that copies the message into the sent folder. You can bypass the API altogether.

Search, try one method, then come back with SPECIFIC questions and we can help. Nobody is going to just do it for you. Anyway, you haven't even shared any details about your setup, so how could we help even if we wanted to?

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

Re: Severity: 3 (Medium), Code: HM5025, Source: PersistentMessage

Post by jimimaseye » 2020-06-03 23:19

Web plug ins create emails (php). Microsoft CDO creates and sends email. Plenty of options, acting like clients, and they all need to point to your server which will do the rest. Even hms scripting can create and send emails. It's there in the documentation and forum (as Palinka has referred you to).

[Entered by mobile. Excuse my spelling.]
5.7 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

Post Reply