Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB 6
|
Pro VB 6 For advanced Visual Basic coders working in version 6 (not .NET). Beginning-level questions will be redirected to other forums, including Beginning VB 6.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 4th, 2003, 10:36 AM
Authorized User
 
Join Date: Jun 2003
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default Receiving mail with Outlook 2000 VBA

I have been using "Outlook 2000 VBA" for the last couple of years and developed various applications to enhance my version of Outlook 2000. The current project I am working on is an anti-spam system.

My goal is to check emails (Deleting the spam) whilst they are still on the server before normal retrieval by Outlook 2000. I have easily achieved most of this using various POP3 libraries but now want Outlook to download the remaining mails only when the server has been "cleaned".

How do I programmatically, through the Outlook object model, cause Outlook to check for new messages. Manually, one would do this by:
a) Pressing F5;
b) Pressing the Send/Receive button, OR;
c) Tools - Send/Receive - All Accounts

Obviously I would like my application to be running in the background (Or regularly scheduled), downloading the non-spam email at regular intervals - similar to the "Mail Delivery" option of check for new messages every X, however not being driven by Outlook but instead my external application.

I have found the CreateItem method but nothing comparable for retrieving mail.

Thanks for any help that can be offered,

Regards

Simon
 
Old July 6th, 2003, 02:35 AM
Registered User
 
Join Date: Jun 2003
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hai Friends
        I got One Doubt.
        In My office i have One Printer Shared Accros 10 systems.
        I want to Find How many printout taken and which system How many.Can anyone Help Me
Very urgent



Thanks is Advance.
Amar.


Failure is not a Defeat it is just a Delay
 
Old July 10th, 2003, 07:27 AM
Authorized User
 
Join Date: Jun 2003
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thankyou Amar for your posting but I don't believe that it relates to the problem of programmatically retrieving mail through VBA and Outlook 2000, perhaps Amar you would like to try starting your own topic?

Does anyone else have any solutions for the question of how to programmatically retrieving mail through VBA and Outlook 2000?

Regards & thanks,

Simon
 
Old July 10th, 2003, 07:37 AM
Authorized User
 
Join Date: Jun 2003
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Simon

I can send you a class for Outlook 2000 Automation if you like. This should help in what you are doing.

Cheers

Byron
 
Old July 10th, 2003, 10:09 AM
Authorized User
 
Join Date: Jun 2003
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Byron,

Many thanks for the classes that you were kind enough to send through, however these only covered creating/sending mail, together with working with Contacts / Tasks folders and creating new folders - which are all pretty much covered within the book, "Outlook 2000 VBA".

I am still on the lookout for how to provoke Outlook to retrieve mail off of its POP server.

Anyone else?

Regards

Simon
 
Old July 10th, 2003, 11:04 AM
Authorized User
 
Join Date: Jun 2003
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Simon,

Can you not just schedule outlook to check for mail every x mins.
 
Old July 10th, 2003, 11:32 AM
Authorized User
 
Join Date: Jun 2003
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Unfortunately not, as such an approach would rely upon the spam-killing software to have successfully run (And processed any required user input) each time and things could very quickly come out of step.

Such a "work around" approach might work in some situations however the problem with junk mail is that methods are changing and the software would upon occasion need to ask the user if a new format of mail was from someone new or suspect.

In all honesty having outlook scheduled to check for mail every X minutes would probably cause more problems than an attended version needing F5 to be pressed after manually running the application.

As I mentioned in the original posting, the goal is to have the anti-spam app scheduled or have a scheduler within it to a) Sanitise the server (Which may take some time depending upon volume and only then b) Instruct outlook to check for new mail.

You see my problem? :)

Regards,

S
 
Old July 17th, 2003, 03:04 PM
Authorized User
 
Join Date: Jun 2003
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have just been pointed to http://www.freevbcode.com/ShowCode.Asp?ID=2139

Rather than writing in VB, I am in fact using Visual FoxPro, so have found that the example text pointed to needed some modifications.

In case anyone is wondering, here is the solution that I found to work:
************************************************** ******
LOCAL loOutlook, loCommandBarCollection, loStandardCB
*
loOutlook = CREATEOBJECT("outlook.application")
*
= loOutlook.GetNameSpace("MAPI").GetDefaultFolder(6) .GetExplorer && Make sure that a mail folder (I have chosen the Inbox) is active, even if still hidden - as one can't Send/Receive from say a Notes folder
*
loCommandBarCollection = loOutlook.ActiveExplorer.CommandBars
FOR x = 1 TO loCommandBarCollection.Count
    IF PADR(UPPER(loCommandBarCollection.Item(x).Name), 10) = "STANDARD "
        loStandardCB = loCommandBarCollection.Item(x)
        EXIT
    ENDIF
ENDFOR
IF TYPE("loStandardCB") # "O" && Just incase the Standard toolbar can't be found
    RETURN .F.
ENDIF
= loStandardCB.Controls("Send/Receive").Execute
RETURN .T.
************************************************** ******





Similar Threads
Thread Thread Starter Forum Replies Last Post
E-mail using VBA and Outlook cc16 Access VBA 6 December 4th, 2006 11:07 AM
Receiving mail with Outlook 2000 VBA spotts-71 All Other Wrox Books 3 August 24th, 2004 10:41 AM
Outlook 2000, VBA, random signatures michaelrayadkins Beginning VB 6 1 June 4th, 2004 07:49 AM
receiving mails from outlook using webapplication spvarapu .NET Web Services 2 January 26th, 2004 09:42 AM
Outlook 2000 VBA - Receive mail... spotts-71 VB How-To 2 July 17th, 2003 02:56 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.