bonjour à tous
j'utilise ce code pour envoyer un mail par CDO
Sub newmailmethod()
Dim Piecejointe As String
Dim iMsg As Object
Dim iConf As Object
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
iConf.Load -1
Set Flds = iConf.Fields
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "mailexpéditeur"
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "pass"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.truc.org"
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
.Update
End With
strbody = "Hi there" & vbNewLine & vbNewLine & _
"This is line 1" & vbNewLine & _
"This is line 2" & vbNewLine & _
"This is line 3" & vbNewLine & _
"This is line 4"
With iMsg
Set .Configuration = iConf
.To = "destinataire"
.CC = ""
.BCC = ""
.From = """EXPEDITEUR"" <expéditeur@gmail.com>"
.Subject = "test flr"
.TextBody = strbody
.Send
End With
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
End Sub
j'ai le message d'erreur :le chemin d'accès du répertoire est requis et n'a pas été spécifié
le blocage se fait sur la ligne ".send"
merci de votre aide
Kinel
j'utilise ce code pour envoyer un mail par CDO
Sub newmailmethod()
Dim Piecejointe As String
Dim iMsg As Object
Dim iConf As Object
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
iConf.Load -1
Set Flds = iConf.Fields
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "mailexpéditeur"
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "pass"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.truc.org"
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
.Update
End With
strbody = "Hi there" & vbNewLine & vbNewLine & _
"This is line 1" & vbNewLine & _
"This is line 2" & vbNewLine & _
"This is line 3" & vbNewLine & _
"This is line 4"
With iMsg
Set .Configuration = iConf
.To = "destinataire"
.CC = ""
.BCC = ""
.From = """EXPEDITEUR"" <expéditeur@gmail.com>"
.Subject = "test flr"
.TextBody = strbody
.Send
End With
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
End Sub
j'ai le message d'erreur :le chemin d'accès du répertoire est requis et n'a pas été spécifié
le blocage se fait sur la ligne ".send"
merci de votre aide
Kinel