Comment envoyer un mail d'alerte avec Cx-Supervisor ?
Éléments de réponses
on error resume next
Const schema = "http://schemas.microsoft.com/cdo/configuration/"
Dim objMsg, oConf
' E-mail properties
Set objMsg = CreateObject("CDO.Message")
objMsg.To = txtRecipient ' or "Recipient Name "
objMsg.Subject = txtSubject
objMsg.From = txtSenderName ' or "Sender Name "
'Add cc & bcc like this
'objMsg.Cc = "email@domain.com"
'objMsg.Bcc = "email@domain.com"
' Add attachments like this, specifying the file name with full path
'objMsg.AddAttachment (FileName1)
objMsg.TextBody = txtBodyText
' GMail SMTP server configuration and authentication info
Set oConf = objMsg.Configuration
oConf.Fields(schema & "smtpserver") = "smtp.gmail.com" 'server address
oConf.Fields(schema & "smtpserverport") = 25 'email port number (sometimes 465 or 587)
oConf.Fields(schema & "sendusing") = 2 ' Send Using Port (cboSendUsingPort)
oConf.Fields(schema & "smtpauthenticate") = 1 'authentication type (cboBasic)
' Report any error
If Err.Number <> 0 AND Err.Number <> 1041 then
MsgBox "ERROR " & Err.Number & ": " & Err.Description
Err.Number= 0
Else
MsgBox "Message sent OK"
end if