?
Solved

How can I download attachment files from mail using PB and save them in specific path?

Posted on 2003-10-29
3
Medium Priority
?
845 Views
Last Modified: 2013-12-26
How can I download attachment files from mail i recieved using PB and save them in specific path? (any code example?)
0
Comment
Question by:Ofen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 8

Expert Comment

by:Vikas_Dixit
ID: 9642310
hi,
 ARE U USING THE mapI, OR SOME THIRD PARTY CONTROL ??
 This is what I find in the help of mailsession.mailReadMessage()

Reading attachments :  If a message has an attachment and you don't suppress attachments, information about it is stored in the AttachmentFile property of the mailMessage object. The AttachmentFile property is a mailFileDescription object. Its PathName property has the location of the temporary file that mailReadMessage created for the attachment. By default, the temporary file is in the directory specified by the TEMP environment variable.

You can copy these temp files to required location.

regards,
Vikas Dixit
0
 

Author Comment

by:Ofen
ID: 9643469
Hi,
I use the MAPI.
What does it means suppress attachment? why should I suppress?

AttachmentFile will give me the files name. what do I do with mailFileDescription
or how I connect it to something and do a file download? when does it put the file intemporary path?

do you have code example to implement it?

thanks,
Ofer
0
 
LVL 8

Accepted Solution

by:
Vikas_Dixit earned 1200 total points
ID: 9651689
Hi Ofen,

 I have not used the anove functions, so don't have any code.

Here's code snippet from PB Help :
Suppose you alredy have a mailsession connected (mSes)

mailMessage msg

long n, c_row

mSes.mailGetMessages()
FOR n = 1 to UpperBound(mSes.MessageID[])
    mSes.mailReadMessage(mSes.MessageID[n], msg, mailEnvelopeOnly! , FALSE)
    c_row = dw_1.InsertRow(0)
    dw_1.SetItem(c_row, "msgid", mSes.MessageID[n])
    dw_1.SetItem(c_row, "msgdate", msg.DateReceived)
    // Truncate subject to fit defined column size
    dw_1.SetItem(c_row, "msgsubject",   Left(msg.Subject, 50))
NEXT

Now if you want to see/move attachments of  say message no 6, then you can call

mSes.mailReadMessage(mSes.MessageID[6], msg, mailEntireMessage! , FALSE) // or use mailBodyAsFile!

After this call, the temporary files will be created. Now check the AttachmentFile[ ]       property

ls_nunAttachments = Upperbound( msg.AttachmentFile[ ])

 And you will have the path/name of temporary files corresponding to each attachment in the PathName property of each msg.AttachmentFile.

Hope this helps,
regards,
Vikas Dixit

 
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question