Infinite Loop

Email Problem

Very weird email problem today. I have this repeating email error message that I can’t delete. Or to be more precise, I can select it and throw it in the trash and even delete it from the trash but it automatically repopulates in my In Box. I deleted the offending email off the POP-Server but I don’t think it’s a server issue, it’s a weird Apple Mail issue as I’m not getting the repeat message on any other mail client.

A pain in the okole.

*UPDATE* Problem fixed (if not solved). Complicated instructions below for future reference should this problem happen again. Warning! GeekSpeak Below.

It looks like manually getting rid of the offending *.emlx files and re-creating the index will be necessary here. Assuming this is a POP account, proceed as follows:

1. Select the offending messages in Mail.

2. Copy the following script, open /Applications/AppleScript/Script Editor, paste the script there, and click Run:

set theFileList to {}
tell application "Mail"
set theSelection to the selection
repeat with aMessage in theSelection
set aFileName to (id of aMessage as string) & ".emlx"
copy aFileName to the end of theFileList
end repeat
end tell
get theFileList

A list of the *.emlx files associated with the offending messages should appear in the script’s Result pane (and in Script Editor’s Window > Result History).

If the troublesome messages appear in more than one mailbox, repeat the steps above for each mailbox and take note of the results.

3. Quit Mail.

4. In the Finder, go to ~/Library/Mail/. Make a backup copy of this folder, just in case something goes wrong, e.g. by dragging it to the Desktop while holding the Option (Alt) key down. This is where all your mail is stored.

5. In the Finder, go to the ~/Library/Mail/POP-username@mailserver/ account folder.

6. Move Deleted Messages.mbox to the Trash if there is nothing to be preserved there.

7. For each mailbox affected by the problem, locate the offending *.emlx files within its Messages folder and move them out of there, e.g. to the Desktop. You can open the *.emlx files with a text editor to view their contents and check that they do indeed correspond to the offending messages before getting rid of them.

8. Go back to ~/Library/Mail/, locate Envelope Index and move it to the Trash. If you see an Envelope Index-journal file there, delete it as well.

9. Open Mail. It will tell you that your mail needs to be “imported”. Click Continue and Mail will proceed to re-create Envelope Index — Mail says it’s “importing”, but it just re-creates the index if the mailboxes are already in Mail 2.x format.

Note: For those not familiarized with the ~/ notation, it refers to the user’s home folder, i.e. ~/Library is the Library folder within the user’s home folder.

From the Apple Discussion forums.

Leave a Reply

Your email address will not be published. Required fields are marked *