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
| Sub essai_envoi_mail()
'
Dim MsSchm$, Cd0Conf As Object, CdoMsg As Object
MsSchm$ = "http://schemas.microsoft.com/cdo/configuration/"
Set Cd0Conf = CreateObject("CDO.Configuration")
With Cd0Conf.Fields
.Item(MsSchm$ & "smtpauthenticate") = 1
.Item(MsSchm$ & "smtpusessl") = True
.Item(MsSchm$ & "smtpserver") = "smtp.gmail.com"
.Item(MsSchm$ & "sendusername") = "senderName@gmail.com"
.Item(MsSchm$ & "sendpassword") = "senderPassword"
.Item(MsSchm$ & "smtpserverport") = 465
.Item(MsSchm$ & "sendusing") = 2
.Item(MsSchm$ & "connectiontimeout") = 100
.Update
End With
Set CdoMsg = CreateObject("CDO.Message")
With CdoMsg
Set .Configuration = Cd0Conf
.From = "senderName"
.To = "recipient@yahoo.com"
.Subject = "This Test"
.TextBody = "Testing"
.Send
End With
End Sub |
Partager