Bonsoir,

je souhaiterais envoyer un fichier préalablement sauvegardé via Gmail et il faut dire que j'ai trouvé peu d'info's sur le NET au contraire d'Outlook.

La sauvegarde en PDF se déroule bien, le problème se situe au niveau de la dernière ligne d'instruction qui génère une erreur "la valeur SendUsing est non valide"

voici le code utilisé:
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
Sub CDO_Mail_Small_Text()
    Dim iMsg As Object
    Dim iConf As Object
    Dim strbody As String
    Dim Flds As Variant
    Dim PDFfileName As String
    Dim myAdd As String
 
 
    Set iMsg = CreateObject("CDO.Message")
    Set iConf = CreateObject("CDO.Configuration")
    iConf.Load -1    ' CDO Source Defaults
    Set Flds = iConf.Fields
    With Flds
        .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"    'change to "smtp.your_ISP"
        .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") = "mon adresse@gmail.com"
        .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "mon mot de passe"
         .update
    End With
    PDFfileName = "chemin du fichier.pdf"
 
    With iMsg
        Set .Configuration = iConf
 
        .To = "mon [email]correspondant@ISP.be"
        .CC = ""
        .BCC = ""
        .From = "mon adresse [email]mail@gmail.com"
        .Subject = "ceci est un mail test"
        .TextBody = "blabla....."
        .AddAttachment PDFfileName
        .Send
    End With
End Sub
Là je suis largé :-) depuis longtemps et donc si quelqu'un peu m'aider à résoudre le problème je l'en remercie vivement.