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
| Dim wshShell, objEnv, strEmail, strrpt
Set wshShell = Wscript.CreateObject("Wscript.Shell")
Set objEnv = wshShell.Environment("PROCESS")
strrpt=objEnv("RPT")
'msgbox strrpt
'strEmail = objEnv("EMAIL")
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "OBJET"
objMessage.From = objEnv("EMAIL")
objMessage.To = "DESTINATAIRE@DE.choix"
objMessage.TextBody = "MESSAGE DU MAIL"
'Ajout de la PJ
'msgbox "C:\temp\"&strrpt
objMessage.AddAttachment "C:\temp\"&strrpt
'==configuration pour le serveur de SMTP distant .
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
'Nom du serveur SMTP
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtpserver"
'Port serveur
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMessage.Configuration.Fields.Update
'==Envoi du message==
objMessage.Send |