Solved

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

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

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…
Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

759 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

23 Experts available now in Live!

Get 1:1 Help Now