Thunderbird incorrectly handles Simple MAPI attachments if they have a '-' in the file name



11 years ago
9 years ago


(Reporter: dave_lowrey, Unassigned)



1.8 Branch
Windows XP

Firefox Tracking Flags

(Not tracked)


(Whiteboard: [closeme 2010-02-15])


(1 attachment)



11 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20071127 Firefox/
Build Identifier: version (20071031)

I wrote a C++ application to call a user's default email application to send an email with an attachment.

The program works with Outlook Express. However, it does not work with Thunderbird if the file I am attaching has a '-' in it's name (such as document-2.txt).

When Thunderbird is the default email application and I run my program, the compose mail window comes up with the correct subject and message body. The attachment is also listed. But, when I go to send the e-mail, Thunderbird complains that it cant find the attachment file.

If I change the filename to anything that doesn't have a '-' in it's name, the program works just fine with Thunderbird.

Reproducible: Always

Steps to Reproduce:
1. Compile the code listed below. 
2. Create the file c:\document=2.txt It can contain anything you want as it is used for the attachment.
3. Ensure that Thunderbird is your default mail program.
4. Run the compiled program. You should get a message composition window.
5. Specify a recipient for the email
6. Click on the Send button - You should get an erro rmessage
7. Go to the source and change the file name to document2.tct and recompile
8. Rename the test file to document2.txt
9. re-run the program. When the message composition window comes up, fill in a recipient and click send
10. The email should now send successfully.

Here is my code:
#include "stdafx.h"

#include <windows.h>
#include <stdio.h>
#include <mapi.h>


char *mymessage = "Testing 1 2 3";
char *pathname = "c:\\message-2.eml";
char *filename = "message-2.eml";

MapiFileDesc attachment = {0,         // ulReserved, must be 0
                           0,         // no flags; this is a data file
                           (ULONG)-1, // position not specified
                           pathname,  // pathname
                           filename,      // original filename
                           NULL};               // MapiFileTagExt unused

// Create a blank message. Most members are set to NULL or 0 because
// MAPISendMail will let the user set them.
MapiMessage note = {0,            // reserved, must be 0
                    "Test Subject",         // no subject
                    NULL,         // no note text
                    NULL,         // NULL = interpersonal message
                    NULL,         // no date; MAPISendMail ignores it
                    NULL,         // no conversation ID
                    0L,           // no flags, MAPISendMail ignores it
                    NULL,         // no originator, this is ignored too
                    0,            // zero recipients
                    NULL,         // NULL recipient array
                    1,            // one attachment
                    &attachment}; // the attachment structure

void main(void)

    hMAPILib = LoadLibrary("MAPI32.DLL");

    lpfnMAPISendMail =
        (LPMAPISENDMAIL)GetProcAddress((struct HINSTANCE__ *)hMAPILib, "MAPISendMail");

    (*lpfnMAPISendMail)(0L,          // use implicit session.
                    0L,          // ulUIParam; 0 is always valid
                    &note,       // the message being sent
                    MAPI_DIALOG, // allow the user to edit the message
                    0L);         // reserved; must be 0
    printf("Message sent.\n");

    FreeLibrary((struct HINSTANCE__ *)hMAPILib);
Actual Results:  
An error message saying that the attachment can't be found

Expected Results:  
The email should have been sent

Comment 1

11 years ago
I had a typo in my original report (sorry)
The file name in step 2 should be document-2.txt, not document=2.txt

Comment 2

11 years ago
Created attachment 292305 [details]
C++ program that demonstrates the problem
worksforme (wfm) on
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20091005 Shredder/3.0pre

I did not use the c++ prog however, just mapi from winword.
Reporter (David Lowrey), do you still see this bug with recent nightly version of TB3? (
Component: General → Simple MAPI
Product: Thunderbird → MailNews Core
QA Contact: general → simple-mapi
Keywords: testcase

Comment 4

9 years ago
worksforme (wfm)
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20100111 Thunderbird/3.0.1

using WINxp and send to from WIN exploere with both names variations:
Reporter (David Lowrey), do you still see this bug with recent version
of TB3?


9 years ago
Whiteboard: [closeme 2010-02-15]
Version: unspecified → 1.8 Branch
RESOLVED INCOMPLETE due to lack of response to last question. If you feel this change was made in error, please respond with your reasons why.
Last Resolved: 9 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.