Closed Bug 235432 Opened 18 years ago Closed 10 years ago

Mailnews/Thunderbird leaves unused nsqmail.tmp (nsqmail-*.tmp, nsemail.eml) files in temporary folder (TEMP or /tmp) after quit


(MailNews Core :: Networking: SMTP, defect)

Not set


(Not tracked)

Thunderbird 13.0


(Reporter: aceman, Assigned: hiro)


(Blocks 3 open bugs)


(Keywords: privacy)


(1 file)

Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7a) Gecko/20040128 Firebird/0.8.0+

I don't know how to reproduce it on demand. It never happend to me. But I often
look in windows/temp dir and find files called nsqmail-N.tmp (N is an integer),
containing messages composed by the other user of my PC. He uses the same
Mozilla but a different profile. I don't know how he does it, or what strange
composing habits he has. We both prepare texts in external text files and then
(while offline) paste them in new emails/replies.

Reproducible: Sometimes
Steps to Reproduce:

Expected Results:  
No temporary files should be left.
Product: MailNews → Core
I looked into the source but it is horrible :( The code paths aren't that linear... 
The nsqmail.tmp file is created just before a message is sent. It is deleted
after (successful???) send.

So, I couldn't find the spot so far, but there must be a case which causes this
file to not be deleted. Maybe when the SMTP server returns an error? Or the file
is locked (opened with some other thread)?
Component: MailNews: Composition → Networking: SMTP
Summary: Mailnews leaves stray nsqmail-*.tmp files in temp after shutdown. → Mailnews leaves stray nsqmail.tmp (nsqmail-*.tmp) files in temporary folder after quit.
This is a privacy issue, because on win9x, the files are readable by any user
and the owner doesn't know about them.
Keywords: privacy
Summary: Mailnews leaves stray nsqmail.tmp (nsqmail-*.tmp) files in temporary folder after quit. → Mailnews leaves unused nsqmail.tmp (nsqmail-*.tmp) files in temporary folder after quit
Version: Trunk → 1.7 Branch
This is an automated message, with ID "auto-resolve01".

This bug has had no comments for a long time. Statistically, we have found that
bug reports that have not been confirmed by a second user after three months are
highly unlikely to be the source of a fix to the code.

While your input is very important to us, our resources are limited and so we
are asking for your help in focussing our efforts. If you can still reproduce
this problem in the latest version of the product (see below for how to obtain a
copy) or, for feature requests, if it's not present in the latest version and
you still believe we should implement it, please visit the URL of this bug
(given at the top of this mail) and add a comment to that effect, giving more
reproduction information if you have it.

If it is not a problem any longer, you need take no action. If this bug is not
changed in any way in the next two weeks, it will be automatically resolved.
Thank you for your help in this matter.

The latest beta releases can be obtained from:
I can see this almost every day, how comes nobody can reproduce it?
sorry for the spam.  making bugzilla reflect reality as I'm not working on these bugs.  filter on FOOBARCHEESE to remove these in bulk.
Assignee: sspitzer → nobody
Filter on "Nobody_NScomTLD_20080620"
QA Contact: esther → networking.smtp
Aceman, do you see this with newer Thunderbird, and newer OS? 

Under normal conditions this is WFM - I tested with TB trunk imap account and pop, files are temporarily (for Vista) in C:\Users\<username>\AppData\Local\Temp as nscopy.tmp and other names, then gone.

However, files can get left there if sending is in progress during a crash.  Confirmed via testing
Severity: normal → major
Product: Core → MailNews Core
fixing status
Ever confirmed: true
This does still happen, even on Thunderbird 7 on linux. I haven't seen it before about Thunderbird 6 on this machine. It seems like a regression.
On linux in /tmp the files are called nsemail.eml or nscopy.eml. Currently, files that I see in /tmp contain messages that were processed by enigmail, they contain encrypted text.
But on the Win98 machine which I reported in comment 0 does not have enigmail.
Summary: Mailnews leaves unused nsqmail.tmp (nsqmail-*.tmp) files in temporary folder after quit → Mailnews/Thunderbird leaves unused nsqmail.tmp (nsqmail-*.tmp, nsemail.eml) files in temporary folder (TEMP or /tmp) after quit
An easiest way to see remaining files in \Temp is;
1. Compose a mail, attach many mails(drag&drop may mails from thread pane)
2. Send Later, and Cancel while Tb is creating mail data => files remain
3. Terminate Tb => files stil remain
OS: Windows 98 → All
Version: 1.7 Branch → Trunk
I've been trying to write an xpcshell test for this, but can't yet...
Attachment #595205 - Flags: review?(dbienvenu)
Comment on attachment 595205 [details] [diff] [review]
Fix for comment #10 case

thx, looks good.
Attachment #595205 - Flags: review?(dbienvenu) → review+
Keywords: checkin-needed
Assignee: nobody → hiikezoe
Checked in:
Closed: 10 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 13.0
Depends on: 731907
Blocks: 732334
Duplicate of this bug: 299655
Duplicate of this bug: 77810
Blocks: 58979
Duplicate of this bug: 58580
So, the patch cleans up temp files created for attachments, in the case when the sending is aborted. Before, we left behind those files when we abort, now we delete them.

The tmp file is created here in nsMsgAttachmentHandler.cpp:
517     rv = nsMsgCreateTempFile("nsmail.tmp", getter_AddRefs(tmpFile));
518     NS_ENSURE_SUCCESS(rv, rv);
519     mTmpFile = do_QueryInterface(tmpFile);

That means we'll clean up nsmail-*.tmp files. However, we will not clean up nsemail-*.tmp files that I also see. Thus, I will re-open bug 299655 for those.
You need to log in before you can comment on or make changes to this bug.