dear hamil users.
as you know hmailserver dose not save message subject in hm_messages table so if you use hmailserver for a big site and many emails it will be so slowly so i will modified hmail server 5.4 source code and saved message_subject and message_hasattatch in hm_messages table.
now i need to update to latest version and i could not compile new version.
can any one help me to write an script to save message_subject and message_hasattatch in my hm_messages table?
i want it happen when message is going to deliver i guess it should happened on OnDeliverMessage event.
thanks for your guide
Script to save message subject in database
Re: Script to save message subject in database
Well...behroozak wrote: ↑2023-06-06 17:56dear hamil users.
as you know hmailserver dose not save message subject in hm_messages table so if you use hmailserver for a big site and many emails it will be so slowly so i will modified hmail server 5.4 source code and saved message_subject and message_hasattatch in hm_messages table.
now i need to update to latest version and i could not compile new version.
can any one help me to write an script to save message_subject and message_hasattatch in my hm_messages table?
i want it happen when message is going to deliver i guess it should happened on OnDeliverMessage event.
thanks for your guide
Code: Select all
SELECT hm_messages.messageid, hm_message_metadata.metadata_subject
FROM hm_messages
JOIN hm_message_metadata ON hm_messages.messageid = hm_message_metadata.metadata_messageid
WHERE hm_message_metadata.metadata_subject = 'Subject to find';
SørenR.
Woke is Marxism advancing through Maoist cultural revolution.
Woke is Marxism advancing through Maoist cultural revolution.
Re: Script to save message subject in database
^ doesn't address the attachment thingy. But yeah, the subject is already recorded, of course.SorenR wrote: ↑2023-06-07 00:26Well...behroozak wrote: ↑2023-06-06 17:56dear hamil users.
as you know hmailserver dose not save message subject in hm_messages table so if you use hmailserver for a big site and many emails it will be so slowly so i will modified hmail server 5.4 source code and saved message_subject and message_hasattatch in hm_messages table.
now i need to update to latest version and i could not compile new version.
can any one help me to write an script to save message_subject and message_hasattatch in my hm_messages table?
i want it happen when message is going to deliver i guess it should happened on OnDeliverMessage event.
thanks for your guide
Code: Select all
SELECT hm_messages.messageid, hm_message_metadata.metadata_subject FROM hm_messages JOIN hm_message_metadata ON hm_messages.messageid = hm_message_metadata.metadata_messageid WHERE hm_message_metadata.metadata_subject = 'Subject to find';
You don't mention the structure of column message_hasattach, but....behroozak wrote: ↑2023-06-06 17:56dear hamil users.
as you know hmailserver dose not save message subject in hm_messages table so if you use hmailserver for a big site and many emails it will be so slowly so i will modified hmail server 5.4 source code and saved message_subject and message_hasattatch in hm_messages table.
now i need to update to latest version and i could not compile new version.
can any one help me to write an script to save message_subject and message_hasattatch in my hm_messages table?
i want it happen when message is going to deliver i guess it should happened on OnDeliverMessage event.
thanks for your guide
Code: Select all
Function GetDatabaseObject()
Dim oApp : Set oApp = CreateObject("hMailServer.Application")
Call oApp.Authenticate("Administrator", "supersecretpassword")
Set GetDatabaseObject = oApp.Database
End Function
Sub OnDeliverMessage(oMessage)
Dim oDB : Set oDB = GetDatabaseObject
Dim hasattach : hasattach = False
Dim strSQL
If oMessage.Attachments.Count > 0 Then hasattach = True
strSQL = "UPDATE hm_messages SET message_subject = " & Chr(34) & oMessage.Subject & Chr(34) & ", message_hasattach = " & hasattach & " WHERE messageid = " & Chr(34) & oMessage.ID & Chr(34) & ";"
Call oDB.ExecuteSQL(strSQL)
Set oDB = Nothing
End Sub