Keep raw messages for ever #3491
-
SummaryKeep outgoing and incomming messages for ever in database. DetailsWe can set the number of days that postal will keep our messages. We can set this number in advance settings of mail server. Is there any option that we can keep the messages for ever? For example, although I set that number to Is there such option in postal. If yes, help me. If not, what should we do? can. we set the number to 10000000 days? =) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
|
Postal isn't really designed for long term storage of messages, the search isn't that great and it doesn't have mailing lists, templates, or any real context around the messages. Its better for you to log the message where it originates and listen to webhooks so your application can be sure of what happened to the message. |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for the explanation. I checked the piece of code related to removing raw messages. Based on what I understood from the code and the docs, if max_age is set to -1, then no messages should ever be removed and they should stay on disk. This is the snippet I’m referring to: def remove_messages(max_age = 60)
time = (Time.now.utc.to_date - max_age.days).to_time.end_of_day
return unless newest_message_to_remove = @database.select(
:messages,
where: { timestamp: { less_than_or_equal_to: time.to_f } },
limit: 1,
order: :id,
direction: "DESC",
fields: [:id]
).first
endWith max_age = -1, the calculated time ends up in the future, meaning no record should satisfy timestamp <= time, so nothing should be removed. |
Beta Was this translation helpful? Give feedback.
Postal isn't really designed for long term storage of messages, the search isn't that great and it doesn't have mailing lists, templates, or any real context around the messages.
Its better for you to log the message where it originates and listen to webhooks so your application can be sure of what happened to the message.