omron.jpg Automatisation industrielle | Support Technique France
questions-frequentes.jpg
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)
oConf.Fields(schema & "smtpusessl") = True 'use SSL encryption oConf.Fields(schema & "sendusername") = "youraccount@gmail.com" 'sender account username
oConf.Fields(schema & "sendpassword") = "password" 'sender account password oConf.Fields.Update() ' send message objMsg.Send()
' 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

Informations complémentaires

Catégorie :
Cx-Supervisor
Langage :
Français
Ajouté le :
31/07/2017
Auteur :
Jean-Pierre Viskovic

Logiciel concerné