bonjour,
est il possible en VB5 d'attecher plusieur fichier a un mail automatique???
car je n'y arrive pas.
merci d'avance.
bonjour,
est il possible en VB5 d'attecher plusieur fichier a un mail automatique???
car je n'y arrive pas.
merci d'avance.
J'avais pas vu que tu avais posté 2 questions
Le code complet :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95 Option Explicit '--information destinataire Private Type MapiRecip Reserved As Long RecipClass As Long Name As String Address As String EIDSize As Long EntryID As String End Type '-information fichier attaché Private Type MapiFile Reserved As Long Flags As Long Position As Long PathName As String FileName As String FileType As String End Type Private Sub Command1_Click() Dim arrayRecipient() As MapiRecip Dim arrayFile() As MapiFile On Error GoTo Erreur MAPISession1.SignOn MAPIMessages1.SessionID = MAPISession1.SessionID MAPIMessages1.Compose MAPIMessages1.MsgSubject = "Mon sujet" MAPIMessages1.MsgNoteText = "Mon message :" '-- Liste des destinataires ReDim arrayRecipient(0 To 3) As MapiRecip arrayRecipient(0).Name = "Destinataire1" arrayRecipient(0).Address = "xxx.xxx@free.fr" arrayRecipient(0).RecipClass = mapToList arrayRecipient(1).Name = "Destinataire2" arrayRecipient(1).Address = "yyy.yyy@free.fr" arrayRecipient(1).RecipClass = mapToList arrayRecipient(2).Name = "Destinataire3" arrayRecipient(2).Address = "zzz.zzz@free.fr" arrayRecipient(2).RecipClass = mapCcList arrayRecipient(3).Name = "Destinataire4" arrayRecipient(3).Address = "uuu.uuu@free.fr" arrayRecipient(3).RecipClass = mapBccList Dim i As Integer For i = 0 To UBound(arrayRecipient) MAPIMessages1.RecipIndex = i MAPIMessages1.RecipType = arrayRecipient(i).RecipClass MAPIMessages1.RecipAddress = arrayRecipient(i).Address Next '-- Liste des fichiers attachés MAPIMessages1.MsgNoteText = MAPIMessages1.MsgNoteText & " " ReDim arrayFile(0 To 1) As MapiFile arrayFile(0).FileName = "c:\test1.txt" arrayFile(0).Position = Len(MAPIMessages1.MsgNoteText) - 1 arrayFile(1).FileName = "C:\test1.txt" arrayFile(1).Position = Len(MAPIMessages1.MsgNoteText) For i = 0 To UBound(arrayFile) MAPIMessages1.AttachmentIndex = MAPIMessages1.AttachmentCount MAPIMessages1.AttachmentPathName = arrayFile(i).FileName MAPIMessages1.AttachmentPosition = CLng(arrayFile(i).Position) MAPIMessages1.AttachmentType = mapData Next MAPIMessages1.ResolveName MAPIMessages1.Send True MAPISession1.SignOff Exit Sub Erreur: Select Case Err Case mapUserAbort Case Else MsgBox "Erreur " & Err.Number & " : " & Err.Description, vbExclamation End Select Err.Clear MAPISession1.SignOff End Sub
Partager