Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook and VBA (http://www.outlookbanter.com/outlook-vba/)
-   -   How to create Mail in Outlook Inbox (not for sending) (http://www.outlookbanter.com/outlook-vba/49926-how-create-mail-outlook-inbox.html)

Dominik June 7th 07 11:43 AM

How to create Mail in Outlook Inbox (not for sending)
 
Hi,

I am trying to notify the user about events of my application by placing an
item in his outlook inbox. Currently, I create a MailItem and save it (see
below). This brings two problems:
1. The sender field cannot be set. (It's always empty)
2. The e-mail is flagged as unsent message and thus the user can edit and
send it.

Is there a direct way to create pseudo-E-Mails in the Inbox or a solution to
the problems above? I cannot send a real e-mail, as notifcations have to be
instantaneous.

Thanks a lot.

Dominik

Code: (It's C++, but the object model is the same. So answers in any
language are fine!)

MAPIFolderPtr pInbox;
_ItemsPtr pInboxItems;
_MailItemPtr pNewMail;

pInbox = pMAPI-GetDefaultFolder(olFolderInbox);
pInboxItems = pInbox-Items;
pNewMail = pInboxItems-Add();
pNewMail-Subject = "New Mail Subject";
pNewMail-Body = "New mail body\n";
");

pNewMail-Save(); // saves to Drafts
pNewMail-Move(pInbox);

Dmitry Streblechenko June 7th 07 06:49 PM

How to create Mail in Outlook Inbox (not for sending)
 
I recently replied to a similar post in
microsoft.public.outlook.program_addins (How to store new message item in
Sent folder)

http://groups.google.com/group/micro...bfd6995a46b4c2

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Dominik" wrote in message
...
Hi,

I am trying to notify the user about events of my application by placing
an
item in his outlook inbox. Currently, I create a MailItem and save it (see
below). This brings two problems:
1. The sender field cannot be set. (It's always empty)
2. The e-mail is flagged as unsent message and thus the user can edit and
send it.

Is there a direct way to create pseudo-E-Mails in the Inbox or a solution
to
the problems above? I cannot send a real e-mail, as notifcations have to
be
instantaneous.

Thanks a lot.

Dominik

Code: (It's C++, but the object model is the same. So answers in any
language are fine!)

MAPIFolderPtr pInbox;
_ItemsPtr pInboxItems;
_MailItemPtr pNewMail;

pInbox = pMAPI-GetDefaultFolder(olFolderInbox);
pInboxItems = pInbox-Items;
pNewMail = pInboxItems-Add();
pNewMail-Subject = "New Mail Subject";
pNewMail-Body = "New mail body\n";
");

pNewMail-Save(); // saves to Drafts
pNewMail-Move(pInbox);





All times are GMT +1. The time now is 09:50 AM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com