User Tools

Site Tools


products:stewmail

StewMail

http://example.dev/index.php?do=/stewjob/dumpthread/id_869

This project grew out of http://scripttechs.com/forum/thread/2287/threaded-mail/

It is in progress as of May 2015.

We have a set of utilities to verify threaded mail referential integrity and reconcile orphaned attachments for the local file system or CDN.

Once your data is cleaned up, we have a cron job that will keep it clean.

You specify the number of days to keep mail per user group.

I need to turn my hysterical diatribes into organized notes in this wiki.

This will keep your V3 threaded mail healthy and sane. .

Known anomalies

in other words, this stuff does not work. It is what we need to fix

* Attachments do not always get into the attachment table. They will become orphaned in the file system when a PM is deleted (applies to normal mail as well).

* Counts are wrong for Inbox, Sentbox, and Archive

* Specification for “threaded mail” is unknown and offline. No facebook users here, nobody knows what the original author had in mind.

* Loss of referential integrity. This can happen for many reasons. The purpose of this mod is to track them down. Ultimate cause can be network, so a function for admin to rebuild is missing.

* AdminCP peek/manage mail is unreliable. Might work if everything else gets fixed, but probably has problems of its own.

SELECT phpfox_mail_thread_text.thread_id
FROM phpfox_mail_thread_text
LEFT OUTER JOIN phpfox_mail_thread ON phpfox_mail_thread_text.thread_id = phpfox_mail_thread.thread_id
WHERE phpfox_mail_thread.thread_id IS NULL

* Query above gets us the orphaned messages. Works in phpMyAdmin but fails in the fox database engine, even when result set is small.

What is threaded mail?

The defining algorithm for threaded mail was given by Jamie Zawinski back in the 90's. Implementations in available in several languages.

Clearly phpfox did not consult that. Note the very last line of the page: Just say no to databases!

According to phpfox, threaded mail allows one “conversation” or “thread” between a set of members.

If users A and B are messaging, they do not have dozens of separate entries in their mailbox for each message, but a single entry which contains all messages between them.

A nice convenience. Message history all in one place.

The devil is in the details. Conversations may involve more than just two people.

Another difference. Phpfox normal mail has two columns for text: input and parsed. As do most all other tables for text (blogs, etc). Yet phpfox threaded mail does not. Th reason is unknown. But without digging further, it would seem using threaded mail involves sacrificing the reparser.

Deleting threaded mail

Note that facebook never deletes anything. Their purpose in life is marketing and data crunching for consumer preferences.

They also require data warehouses, flat files and teams of engineers.

Our purpose is not at all the same, nor do we want to run a site with billions of users.

We have social sites, niche communities, and fewer resources. The bulk of PMs on site expire with age and nobody cares what they said or bought or thought any more. We want to trash them before they dog down the sql server.

Unresolved issue

Start a conversation with users A,B,C.

Start a conversation with users A,B.

Both conversations carry on for a while, eventually C drops out and her messages are pruned.

We now have two threads with users A,B. There is no subject attached.

What will that look like? How will A and B sort it out?

Possibly…

* Ignore it, let it fall out, see what it looks like

* Merge the threads

* Include a time_stamp and/or subject in the thread header hash so that the two conversations are visibly separate.

* Only delete entire threads, never the individual messages

* Leave “placeholder” messages where the deletions occurred.

* Stay the fuck away from fox threaded mail. Adapt normal mail to your purpose.

Counts

Once we repair integrity, the counts correct themselves.

But do they make sense?

If I send a message and get a reply that conversation now shows in both Inbox and SentBox.

IN and SENT are concepts that do not apply in any useful way to threaded mail?

SENT is a filter. Filter my conversations by:

  • name
  • date
  • sent
  • text search

…dunno.

Who cares?

Many sites don't even need PMs any more. SMS has taken over for hookups. Consider smartphone technologies.

The “normal” phpfox mail already has message history (each reply has a pointer to the original PM). So if all you need is “a nice message history”, it may be much less work to rework your front end mail template.

So what's the purpose of your threaded mail on your site?

products/stewmail.txt · Last modified: 2015/06/01 08:50 by steward