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 40 41 42 43 44 45 46
|
Str_Destinataire = "DEST"
Str_Sender = "SENDER"
Str_Suppleant = "SUPPLEANT"
Set oMail = Server.CreateObject("CDO.Message")
Set oMailConfig = Server.CreateObject ("CDO.Configuration")
oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "NomDuServeurSMTP"
oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 ' Port utilisé
oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 ' On utilise un service SMTP
oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60 ' Timeout
oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 0 ' 0 = aucune authentification ; 1 = authentification
'oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "USER" ' Utilisateur exchange si authentification = 1
'oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "PWD" ' Mot de passe de l'utilisateur exchange si authentification = 1
oMailConfig.Fields.Update
Set oMail.Configuration = oMailConfig
oMail.Sender = Replace(Str_Sender, " ", ".")
oMail.From = Str_Sender
oMail.Fields.Update()
oMail.Subject = "Objet du mail."
oMail.To = Str_Destinataire
if Str_Suppleant <> "VIDE" then
oMail.CC = Str_Suppleant
end if
Body = ""
Body = Body & "<html>"
Body = Body & "<body>"
Body = Body & "<font face=arial size=3 color=black>"
Body = Body & "<b>"
Body = Body & "Le texte du mail ..... "
Body = Body & "</b>"
Body = Body & "</font>"
Body = Body & "</body>"
Body = Body & "</html>"
oMail.HTMLBody = Body
oMail.Send
Set oMailConfiguration = Nothing
Set oMailConfig = Nothing
Set oMail = Nothing |
Partager