Sub EnvoiMailCDO()
Dim mMessage As Object
Dim mConfig As Object
Dim mChps
'Dim FichierMail
Set mConfig = CreateObject("CDO.Configuration")
mConfig.Load -1
Set mChps = mConfig.Fields
With mChps
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "mail" 'Sheets("Configuration").[N4] 'Mail
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "mdp" 'Sheets("Configuration").[N5] 'Mot de passe
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.serveur.com" 'Sheets("Configuration").[N2] 'Adresse serveur
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 'Sheets("Configuration").[N3] 'port
.Update
End With
'FichierMail = "" 'EMailForm.TextBox5.Value
Set mMessage = CreateObject("CDO.Message")
With mMessage
Set .Configuration = mConfig
.From = "" 'Sheets("Configuration").[N4]
.to = "" 'EMailForm.TextBox2.Value
.Subject = "" & Now 'EMailForm.TextBox3.Value
.TextBody = "" 'EMailForm.TextBox5.Value
'.AddAttachment FichierMail
.Send
End With
Set mMessage = Nothing
Set mConfig = Nothing
Set mChps = Nothing
End Sub