three sections outline suggested improvements and potential exercises alternativepassing header text in hidden input fields (pymailcgi_ perhaps the simplest way to guarantee accurate deletions is to embed the displayed message' full header text in the message view page itselfas hidden form fieldsusing the following schemeonviewlistlink py embed the header text in hidden form fieldsescaped per html conventions with cgi escape (with its quote argument set to true to translate any nested quotes in the header textonviewpageaction py retrieve the embedded header text from the form' input fieldsand pass it along to the safe deletion call in mailtools for header matching this would be small code changebut it might require an extra headers fetch in the first of these scripts (it currently loads the full mail text)and it would require building phony list to represent all mailsheaders (we would have headers for and delete only one mail herealternativelythe header text could be extracted from the fetched full mail textby splitting on the blank line that separates headers and message body text moreoverthis would increase the size of the data transmitted both from client and server--mail header text is commonly greater than kb in sizeand it may be larger this is small amount of extra data in modern termsbut it' possible that this may run up against size limitations in some client or server systems and reallythis scheme is incomplete it addresses only deletion accuracy and does nothing about other synchronization errors in general for examplethe system still may fetch and display the wrong message from message list pageafter deletions of mails earlier in the inbox performed elsewhere in factthis technique guarantees only that the message displayed in view window will be the one deleted for that view window' delete action it does not ensure that the mail displayed or deleted in the view window corresponds to the selection made by the user in the mail index list more specificallybecause this scheme embeds headers in the html of view windowsits header matching on deletion is useful only if messages earlier in the inbox are deleted elsewhere after mail has already been opened for viewing if the inbox is changed elsewhere before mail is opened in view windowthe wrong mail may be fetched from the index page in that eventthis scheme avoids deleting mail other than the one displayed in view windowbut it assumes the user will catch the mistake and avoid deleting if the wrong mail is loaded from the index page though such cases are rarethis behavior is less than user friendly even though it is incompletethis change does at least avoid deleting the wrong email if the server' inbox changes while message is being viewed--the mail displayed will processing fetched mail