Closed Bug 1506488 Opened 6 years ago Closed 5 years ago

Support MAPISendMailW

Categories

(MailNews Core :: Simple MAPI, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1048658

People

(Reporter: jorgk-bmo, Assigned: jorgk-bmo)

Details

Attachments

(2 files, 4 obsolete files)

See bug 1505315 for details.

https://docs.microsoft.com/en-gb/windows/desktop/api/mapi/nc-mapi-mapisendmailw

typedef struct MapiMessageW {
  ULONG            ulReserved;
  PWSTR            lpszSubject;
  PWSTR            lpszNoteText;
  PWSTR            lpszMessageType;
  PWSTR            lpszDateReceived;
  PWSTR            lpszConversationID;
  FLAGS            flFlags;
  lpMapiRecipDescW lpOriginator;
  ULONG            nRecipCount;
  lpMapiRecipDescW lpRecips;
  ULONG            nFileCount;
  lpMapiFileDescW  lpFiles;
}  *lpMapiMessageW;

typedef struct MapiRecipDescW {
  ULONG ulReserved;
  ULONG ulRecipClass;
  PWSTR lpszName;
  PWSTR lpszAddress;
  ULONG ulEIDSize;
  PVOID lpEntryID;
}  *lpMapiRecipDescW;

typedef struct MapiFileDescW {
  ULONG ulReserved;
  ULONG flFlags;
  ULONG nPosition;
  PWSTR lpszPathName;
  PWSTR lpszFileName;
  PVOID lpFileType;
}  *lpMapiFileDescW;
Attached patch 1506488-MAPISendMailW.patch (obsolete) — Splinter Review
How about this? Basically a copy/paste job. The original code was ugly, so it the result.

I added some debug and SendMailW() is now run when using "Sent to > Mail recipient". Sadly no compose window comes up, so something appears to be wrong. This needs more debugging.

I had the impression that something was wrong with subject and body, see bug 1505315 comment #21.

The subject should be:
Emailing: (list of file names)
and the body:
Your message is ready to be sent with the following file or link attachments:
(etc).

I only saw an E and a Y.
Assignee: nobody → jorgk
Status: NEW → ASSIGNED
Attachment #9024328 - Flags: feedback?(VYV03354)
The compose window doesn't open since the file is not found, debug shows:
=== CMapiImp::SendMailW
nsMapiHook::HandleAttachments: filename:  path: D exists = false
=== HandleAttachments 80520006
=== PopulateCompFieldsW 80520006

Something wrong in the string manipulation. That's strange since my initial patch in bug 1505315, attachment 9024216 [details] [diff] [review], didn't show subject/body, but the compose window opened and the file was attached.
Attachment #9024328 - Attachment is obsolete: true
Attachment #9024328 - Flags: feedback?(VYV03354)
I can't get this to work. The "unicode" strings for file path, subject and body aren't correct. No idea why.
Attachment #9024451 - Attachment is obsolete: true
This uses all the wrong structures, subject and body don't work either, but at least the file is attached properly. It's the same filename processing, but here it works and in the other patch it doesn't. Quite puzzling :-(

Masatoshi-san, can you see what's going on?
This patch uses the wrong structures. By the looks of it, the "regular" structures and the "wide" structures are the same apart from the character pointers.

Unlike the other patch which uses the "right" structures, with this patch at least the file gets attached to the message. Subject and body are truncated to one character. In the other patch which uses the "right" structures, nothing works.

So I'm confused.
Attachment #9024556 - Attachment is obsolete: true
Attachment #9024844 - Flags: feedback?(VYV03354)
Oops, I forgot to transplant the unicode processing from the other patch. Here it is now, but subject and body are still only one char long, E(mail ...) and Y(our ...).
Attachment #9024844 - Attachment is obsolete: true
Attachment #9024844 - Flags: feedback?(VYV03354)
Attachment #9024853 - Flags: feedback?(VYV03354)

Mike is working on this, too, and we didn't know :-(

Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → DUPLICATE
Attachment #9024853 - Flags: feedback?(VYV03354)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: