Solved

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

Posted on 2003-10-29
3
840 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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: …
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

863 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now