Show a draft mail as sent mail

E

Ettore

I have a similar problem.
I want to send a mail and I want to save, in the Sent Items folder, another
mail (different from the first one because I change the body).

At the moment I set the attribute DeleteAfterSubmit to true. Then I copy the
mail in the Sent Items Folder (changing the body) and finally I send the
mail.
It works...but the mail I saved isn't a sent mail: it is just a mail saved
(as draft) in the Sent Items folder but not sent and the sent date is setted
to none.
So I tryed to set, using CDO, the Sent and the TimeSent attribute: now the
date is setted correctly but the mail is yet shown as draft.

Can anyone help me?
Is it possible to set a draft mail as sent?

Thanks in advance.
Ettore.
 
D

Dmitry Streblechenko

Create a message as a olPostItem instead (it is created in the sent state),
save it, dereference it, open it using Namespace.GetItemFromID(), set its
MessageClass property to "IPM.Note", save it, dereference it again and
reopen using Namespace.GetItemFromID() - you now have a sent MailItem
object.

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

Ettore

Thanks for your answer.
Just another little question....
How can I set that parameters if I have a MailItem?
I used the copy method to obtain a copy of the mail that I want to save, so
I haven't a PostItem.

Thanks again
Ettore.
 
D

Dmitry Streblechenko

Copy returns a new instance of the same kind (e.g. MailItem), in this case
you can create a brand new post item (Application.Items.Add(olPostItem)),
then copy all relevant properties one by one. Or use Redemption, which has
SafeMailItem.CopyTo() method (allows to copy all properties from one message
to another message passed as an argument).

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

Ettore

Thanks again
I supposed it
Bye Ettore

Dmitry Streblechenko said:
Copy returns a new instance of the same kind (e.g. MailItem), in this case
you can create a brand new post item (Application.Items.Add(olPostItem)),
then copy all relevant properties one by one. Or use Redemption, which has
SafeMailItem.CopyTo() method (allows to copy all properties from one message
to another message passed as an argument).

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top