Salut la compagnie,
Je me suis lance dans la methode decrite dans la faq pour envoyer un mail via CDO.
J avais deja fait ca avec l objet oulook mais ca posait porbleme a cause d un boite de dialogue qui souvre a chque fois.
Je ai repris le code de la faq je n ai pas de probleme de compilation mais bien une erreur lors de l execution.
le debugger me souligne la ligne .Send
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 Public Sub CDOSendMail(SendFrom As String, _ SendTo As String, _ Subject As String, _ PlainTextBody As String) Dim cdoMail As CDO.Message Dim iBp As CDO.IBodyPart ' for IBodyPart on message Dim iBp1 As CDO.IBodyPart Dim Flds As ADODB.Fields Dim Stm As ADODB.Stream 'Dim FullPathFileName As String 'FullPathFileName = "C:\Documents and Settings\NLBERN01\Contact Lijst\Applicatie\ContactLijst.xls" Set cdoMail = New CDO.Message With cdoMail .From = SendFrom .To = SendTo .Subject = Subject ''Set iBp = .BodyPart Set iBp = cdoMail '?? ' TEXT BODYPART ' Add the body part for the text/plain part of message Set iBp1 = iBp.AddBodyPart ' set the fields here Set Flds = iBp1.Fields Flds("urn:schemas:mailheader:content-type") = "text/plain; charset=""iso-8859-1""" Flds.Update ' get the stream and add the message Set Stm = iBp1.GetDecodedContentStream Stm.WriteText PlainTextBody Stm.Flush ' HTML BODYPART ' Do the HTML part here Set iBp1 = iBp.AddBodyPart ' set the content-type field here Set Flds = iBp1.Fields Flds("urn:schemas:mailheader:content-type") = "text/html" Flds.Update ' get the stream and add message HTML text to it Set Stm = iBp1.GetDecodedContentStream Stm.WriteText "<HTML><H1>this is some content for the body part object</H1></HTML>" Stm.Flush ' Now set the Message object's Content-Type header ' to multipart/alternative Set Flds = iBp.Fields Flds("urn:schemas:mailheader:content-type") = "multipart/alternative" Flds.Update '.AddAttachment FullPathFileName .Send End With End Sub
et ecris le mesage suivant
'The "SendUsing" configuration Value is invalid
Avez vous une idee pour pare cet affront
Merci pour vos suggestions
Laurent
Partager