Bonjour,
Je tente d'envoyer un email depuis VBA en CDO.
J'ai bien la reference 'MS CDO for windows 2000 library'.
Ca faut un petit moment que j'essaie de voir d'où vient le soucis mais sans succès :
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
 
Sub Envoi_CDO()
Dim CdoMessage As Object
Dim Fichier As Variant
 
    ChDir "C:\Temp"
    Fichier = Application.GetOpenFilename("Fichiers PDF (*.pdf), *.pdf")
 
    If Fichier = False Then Exit Sub
 
    Set CdoMessage = CreateObject("CDO.Message")
    With CdoMessage
       With .Configuration.Fields
        .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = "1"
        .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "xxxxx@gmail.com"
        .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "xxxxx"
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = "true"
        .Update
       End With
        .From = "xxxx@gmail.com"
        .Subject = "Exemple"
        .To = "xxxxxx@gmail.com"
        .CC = ""
        .BCC = ""
        .TextBody = "test envoie"
        .AddAttachment Fichier
        .Send
 
     End With
 
    Set CdoMessage = Nothing
End Sub
j'ai le message d'erreur suivant :

Nom : Sans titre 1.jpg
Affichages : 141
Taille : 22,7 Ko

Merci de l'aide