A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

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



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old June 7th 07, 11:43 AM posted to microsoft.public.outlook.program_vba
Dominik
external usenet poster
 
Posts: 2
Default 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);
Ads
  #2  
Old June 7th 07, 06:49 PM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default 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);



 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook Express Inbox to Windows Mail Inbox lukas Outlook - General Queries 2 May 2nd 07 02:22 PM
Sending mail from NewMailEx deletes the mail from the Inbox Ron Outlook and VBA 1 January 10th 07 07:40 PM
Suddenly, my server is not sending mail to my inbox....solution? Meg Outlook Express 10 July 9th 06 09:14 PM
create template for sending email/outlook 2002 Coreslider Outlook - Using Contacts 2 June 23rd 06 06:28 PM
How to create AppointmentItem in inbox (Outlook 2002) Galois Add-ins for Outlook 2 April 27th 06 08:01 AM


All times are GMT +1. The time now is 12:29 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-2025 Outlook Banter.
The comments are property of their posters.