Deleting mail from server programatically (ol2k/ol2k3)

  • Thread starter Thread starter Magnus Holm
  • Start date Start date
M

Magnus Holm

Hi.

My Outlook is setup to leave mail on the server for 14 days.
I would like to delete some of these (spam) mails programatically.
Is there a way to do this using vba?


Magnus
 
No, unless you write your own code that uses POP3 protocol to talk directly
to your POP3 server.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
Dmitry Streblechenko said:
No, unless you write your own code that uses POP3 protocol to talk directly
to your POP3 server.

Okay. Let's say I do. Not being too familiar with how messages are handled
on a pop3 server, my first guess would be to use the id returned by UIDL
<message number>. How do I, in Outlook, find the corresponding id?
MailItem.EntryID is an Internal Outlook id, right?

Magnus
 
Correct. Outlook UID is stored in a property with tag = 0x65A0001E (at least
that's what Outlook 2002 uses, I didn't check other versions).
as well as a named property with GUID =
{00062014-0000-0000-C000-000000000046}, id = 0x8F06, PT_BINARY.
You cannot access it using Outlook Object Model, only Extended MAPI
(C++/Delphi), CDO 1.21 or Redemption.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
Hi, Dmitry
Correct. Outlook UID is stored in a property with tag = 0x65A0001E (at least
that's what Outlook 2002 uses, I didn't check other versions).
as well as a named property with GUID =
{00062014-0000-0000-C000-000000000046}, id = 0x8F06, PT_BINARY.
You cannot access it using Outlook Object Model, only Extended MAPI
(C++/Delphi), CDO 1.21 or Redemption.

Ok. After some hours of Googling, it seems to me that I can get this
property from the mailitem's MAPIOBJECT.
Is this correct, and if it is: how? Some Delphi source code would be of
great help ;-)

Magnus
 
Dmitry!

It all works out now that I got the Extended MAPI units, except for the fact
that I can't find a property containing the information.
I'm using Outlook 2K, which seems to have a different approach to this than
2K3. The 0x65A0001E property tag is supposed to show up in OutlookSpy
(iMessage), right?

Magnus
 
When you look at the message using OutlookSpy (click IMessage), do you see
any named properties that contain the UID?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
Nopes. I guess it's stored somewhere else.

Well... long story short, I upgraded to Outlook XP.
The program works great, deleting mail classified as spam from my pop3
account while leaving the "ham" mail alone.

Finally I can use pop3 on my IPAQ via GSM without having to download 2000
spam messages along with the mail I actually care to read ;-)

Thanks a lot for helping me out, Dmitry!

Magnus
 
Back
Top