Tools Links Login

TestEmailWithManyManyAttachments

You want to send 10 or more files using your VB program but you always get an error, well not any more, here is the solution. Enjoy!

Original Author: Demetrios Pyrenis

Assumptions

MAPISession control, MAPIMessages control

Returns

nothing

Side Effects

I dont think so!

Code

'
'
'
' mapSess = MAPISession Control
' mapMess = MAPIMessages Control
'
'
private sub TestEmailWithManyManyAttachments()
dim Attachments() as string
dim TotAttachments as long
dim i as long
dim attPos as integer
  TotAttachments=2 ' or more
  Redim Attachments(TotAttachments)
  Attachments(1)="c:config.sys"
  Attachments(2)="c:autoexec.bat"
  mapSess.LogonUI = True
  mapSess.SignOn
  mapMess.SessionID = mapSess.SessionID
  mapMess.Compose
  mapMess.MsgSubject = "Some Subject"
  mapMess.MsgNoteText = "  bla bla bla bla bla"

  attPos = 1
  
  For i = 1 To TotAttachments

    If Dir( Attachments(i) ) <> "" Then ' Chek that file exists
      
      mapMess.AttachmentIndex = i - 1
      mapMess.AttachmentPosition = attPos
      mapMess.AttachmentPathName = Attachments(i)      
      
      attPos = attPos + 1
    End If
  Next i
  DoEvents
  
  mapMess.Send True

  DoEvents
  mapSess.SignOff
end sub

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 86 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.