README.md

December 5, 2022 ยท View on GitHub

Download e-mail attachments

Description

This code enables you to download and send e-mail, which will automatically put your

attachments into a given directory.

More Info

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

Submitted On
ByGemma Dobbins
LevelUnknown
User Rating4.2 (161 globes from 38 users)
CompatibilityVB 5.0, VB 6.0
CategoryInternet/ HTML
WorldVisual Basic
Archive File

Source 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