Bonjour,

SVP est ce que quelqu'un peut-il m'expliquer ce code ligne par ligne.
Surtout la méthode CDO

Tous ce qui est en rouge pas la peine.



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
Sub cdo()
 
Dim oCDO
 
Dim Fichier As Variant
 
    ChDir "C:\ "
    Fichier = Application.GetOpenFilename("Fichiers PDF (*.pdf), *.pdf")
    
Set oCDO = CreateObject("CDO.Message")
With oCDO
With .Configuration.Fields
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.ton frs.com"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = "587"
 
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = "1"
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "ton nom d’utilisateur"
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "ton mot de passe"
 
.Update
End With
.From = "ton mail"
.To = "un mail"
.Subject = "Essai de mail" & Now
.TextBody = "Voici un petit message " & vbCrLf & "pour tester l'envoi de mail par CDO/VBScript"
.AddAttachment Fichier
.SendEnd With 
End Sub

Un Grand Merci à vous.