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
Solved

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

Posted on 2003-10-29
3
842 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
  • 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 300 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

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. …
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

838 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