Under forudsætning af at der er MAPI installeret, er der her et kode
eksempel
Mvh
www.cadmageren.dk
Michael Christoffersen
Du skal placere de to controller MapiSession og MapiMessages på din form.
MainForm.Enabled = False ' Sikre dig at brugeren ikke laver andet i dit
program, så længe at mailen sendes.
MailIO_Initialize
If MsgBox(Mail.Prompt, 36, "Send " & Mail.Titel) = vbYes Then
With MAPISession1
.DownLoadMail = False
.SignOn
MAPIMessages1.SessionID = .SessionID
With MAPIMessages1
.Compose
.AddressResolveUI = True
.RecipAddress = Mail.Sendto
.RecipDisplayName = .RecipAddress
.ResolveName
.MsgNoteText = " " & vbNewLine & Mail.Body
.MsgSubject = Mail.Subject
.AttachmentType = mapData
'.AttachmentName =
.AttachmentPathName = sfilename
.AttachmentPosition = 0
.Send True
End With
.SignOff
End With
MsgBox UCase(Left(Mail.Titel, 1)) & Mid(Mail.Titel, 2) & " er
afsendt", vbInformation, "Send"
End If