Tools Links Login

Download e-mail attachments

This code enables you to download and send e-mail, which will automatically put your
attachments into a given directory.

Original Author: Gemma Dobbins

Inputs

Mapisession control, mapimessages control, 2 command buttons and 1 text box.

Code

Private Sub Command1_Click()
  MAPISession1.DownLoadMail = False
  MAPISession1.SignOn
  MAPIMessages1.SessionID = MAPISession1.SessionID
  MAPIMessages1.MsgIndex = -1
  
  MAPIMessages1.Compose
  MAPIMessages1.Send True
  
  MAPISession1.SignOff
End Sub
Private Sub Command2_Click()
  MAPISession1.DownLoadMail = True
  MAPISession1.SignOn
  MAPIMessages1.FetchUnreadOnly = True
  MAPIMessages1.SessionID = MAPISession1.SessionID
  MAPIMessages1.Fetch
  On Error Resume Next
  MAPIMessages1.AttachmentPathName = MAPIMessages1.AttachmentPathName '"c:2000" & MAPIMessages1.AttachmentName & "" 'vartype8 '& MAPIMessages1.AttachmentName & " '"
  Text1.Text = MAPIMessages1.MsgNoteText
  FileCopy MAPIMessages1.AttachmentPathName, ("c:2000" & MAPIMessages1.AttachmentName & "")
  MsgBox "File " & MAPIMessages1.AttachmentName & " sucessfully downloaded to C:2000"

  MAPISession1.SignOff
End Sub

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 112 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.