VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Download e-mail attachments

by Gemma Dobbins (2 Submissions)
Category: Internet/HTML
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Date Added: Wed 3rd February 2021
Rating: (38 Votes)

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

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

Rate Download e-mail attachments

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

Download this snippet    Add to My Saved Code

Download e-mail attachments Comments

No comments have been posted about Download e-mail attachments. Why not be the first to post a comment about Download e-mail attachments.

Post your comment

Subject:
Message:
0/1000 characters