Results 1 to 6 of 6
  1. #1
    2 Star Lounger
    Join Date
    Mar 2007
    Location
    Wikltshire UK
    Posts
    152
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Process Email Received (Oulook 2000 to 2007)

    Hi Again,

    I'm working on a time saving Project for work, which involves printing documentation as it comes in rather than the operator having to interact with it, so to speak. I Think I've sussed most of it , but am still uncertain about how to just process the email received and then process the next one etc etc.

    The way I see it you have to pass the email out via the "Run Code" option in the Outlook Rules and designate it as say the Current "MailItem"

    So The code Runs like this??

    Sub ProcessMail (itm As MailItem) 'Or should that be a Public Function??

    {Do Checking Code to ensure Valid for printing (SAVE PAPER :¬)}

    itm.Printout

    {Code to Print Attachment if Valid for Printing}

    {Plus Other Houskeeping/Recording Tasks}

    {Error Checking}

    End Sub ' And Run Again from Start for next Email

    Is there any problems with this Simple Process to Just Pass the MailItem or is it a bit more involved??

    Also How can I "Flag" the Item in Outlook once its been Processed Correctly, so we can Check the Unflagged Items to make sure we don't miss anything??
    If anyone has a list of all the Properties of a "MailItem" Anywhere that would be Fantastic!!!!

    Respectfully Yours

    Graeme

  2. #2
    2 Star Lounger
    Join Date
    Mar 2007
    Location
    Wikltshire UK
    Posts
    152
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Re: Process Email Received (Oulook 2000 to 2007)

    To answer My Own Question RE Properties of a MailItem:

    SentOnBehalfOfName
    SenderName
    ReceivedByName
    ReceivedOnBehalfOfName
    ReplyRecipientNames
    To
    CC
    BCC
    Body
    HTMLBody
    Recipients
    SenderEmailAddress

    Are their any Others????

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Process Email Received (Oulook 2000 to 2007)

    Type MailItem in the Visual Basic Editor (for example in the Immediate window) and press F1. You should see the help item for the MailItem object, with links labeled Properties, Methods and Events at the top. Click Properties to see a list of properties.
    You can also press F2 in the Visual Basic Editor to open the Object Browser. Type MailItem in the Search box and press Enter. You'll see all properties etc. in the Object Browser. You can click on a property and press F1 to get help.

  4. #4
    2 Star Lounger
    Join Date
    Mar 2007
    Location
    Wikltshire UK
    Posts
    152
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Re: Process Email Received (Oulook 2000 to 2007)

    So According to the Help File If I Set up a Folder in Outlook Move the New Email to it via rules, then Run the code in relation to the New File then Move the MailItem to a storage folder for processing and then run the code below using the properties, that should resolve my problem???

    Set myNamespace = Application.GetNamespace("MAPI")
    Set myFolder = myNamespace.GetDefaultFolder(olFolderInbox)
    myFolder.Display
    Set myItem = myFolder.Items(1)

    {Process In here}

    myItem.Display

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Process Email Received (Oulook 2000 to 2007)

    I hope someone else can help you with that, I don't understand it (that's a limitation on my side, not yours).

  6. #6
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Process Email Received (Oulook 2000 to 2007)

    I'm at least as confused as Hans! <img src=/S/smile.gif border=0 alt=smile width=15 height=15> Some questions and comments:

    Are you trying to print attachments, or the Message item body, or both? In your sample code, what is the objective of displaying the folder?

    It may not be necessary, but because I guess that the Rule triggers on a new mail item, much as Application ItemAdd event operates, I'd recommend that moving the item to another folder be the last step in the code. And to flag the item that it has been printed, for a Boolean flag, you could create and use a custom Category "Printed". If you want to timestamp when it was printed, you'll probably need to create a custom UserProperties property.
    -John ... I float in liquid gardens
    UTC -7±DS

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •