Results 1 to 3 of 3

Thread: How to open a textfile mail attachment for input?

  1. #1
    Guest

    Smile

    Hi
    I've tried opening an e-mail's attachment for input but nothing happened.
    I first used msgbox mailitem.attachments.count
    to verify that vb realy recognizes,the attachments of the specific e-mail.
    but opening the attachment for input to read the data from it(it's a text file), using:
    open mailitem.attachments(1) for input as #1
    coused nothing,while reading characters from the file coused n error massage (masaging that the file isn't open).

    Can anyone help with the appropriate procedure to open a text file attachment for input reading.
    Thanx a lot in advance


    Well... Thanx a lot HDR,actually I'm aware of the array like
    reference to mail attachments, and that was my original way of referencing the attachments, as mentioned in the body of the original question.




    thanx Buzby you're message helped me a lot and currently, actually my problem has solved thanks to you, thank you very much again!!

    [Edited by shmulik on 04-21-2000 at 03:36 PM]

    [Edited by shmulik on 04-27-2000 at 01:14 PM]

  2. #2
    Addicted Member
    Join Date
    Jan 2000
    Location
    Fresno, California, USA
    Posts
    195
    Attachments are a collection of mailitem attachments. You can treat them like an array. Use the following as an example of how to access the attachments.

    myAttachment = myItem.Attachments(index)

    Repeat that to retrieve your stuff until you've done it:

    nCounter = myItem.Attachments.Count

    nCounter times.

  3. #3
    Frenzied Member Buzby's Avatar
    Join Date
    Jan 1999
    Location
    UK
    Posts
    1,670
    If you mean you want to read the file that has been attached to an e-mail you will find that when the e-mail in question is open all the attachments can be found in the WINDOWS\TEMP directory. The Attachment object on the MSMail control tells you the filename of each attachment. I think if you try

    Open MailItem.Attachments(1).Filename ... you might have more luck.

    Of course you could always go to http://www.planetsourcecode.com/vb/
    and search for BuzMail - this is my MSMail 'overlay' that gives you a much easier to use method to send and receive e-mails (with or without attachments). IF you like it please let me know.

    'Buzby'
    Visual Basic Developer
    "I'm moving to Theory. Everything works there."

Posting Permissions

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



Click Here to Expand Forum to Full Width