Categories
technical notes

recovering thunderbird mail

I screwed up my email because, using Thunderbird, i didn’t compact my inbox folder regularly. Combined with an old version of TB which didn’t prompt me to do this, it was all a bit disasterous. Anyway, I wrote this Matlab script to take all the deleted but not removed mails from a mailbox file and make them undeleted/visible again. If this doesn’t make sense, either read about disappearing mail and recovering corrupted folders in Thunderbird or just be grateful that you don’t need to know

%use this at your own risk!
fid=fopen('In_box'); % In_box is my mailfile
fid2=fopen('In_box_new', 'wt'); % In_box_new is the new mailfile
key=['X-Mozilla-Status:'];
while feof(fid)==0
tline = fgetl(fid);
if ~ischar(tline), break, end
if isempty(regexp(tline,key))==0;
tline=['X-Mozilla-Status: 0011'];
end

tline=[tline '\n'];
fprintf(fid2,tline);
end
fclose(fid);
fclose(fid2);

Leave a Reply

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