| 12
 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
 
 | 
'-------------------------
'Declaration des variables
'-------------------------
Dim fsofile 
Dim log
const chemfsofile = "d:\Backup_CRM\eff.log"
'-------------------------
'Initiations des variables
'-------------------------
With CreateObject("CDO.Message")
    Set fsofile = CreatedObject("Scripting.FileSystemObject") 
    set log = fsofile.getfile(chemfsofile)
         
'--------
'code
'--------
  .From=toto@company.be
  .To=server@company.be
  .Subject="Efficy backup"
  .TextBody="Bonjour à tous,"  & vbcrlf _
    & "Vous trouverez en attachement du présent mail le fichier de backup      du: "  & vbcrlf _ 
                  &  day(log.datelastmodified) & "/" month(log.datelastmodified)  & vbctrl_                     & "Merci " & vbcrlf _
    & "        Le serveur Mail "
  .AddAttachment("d:\Backup_CRM\eff.log")
  .Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
  .Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="Mail"
  .Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
  .Configuration.Fields.Update
   On Error Resume Next
   .Send
         If Err Then MsgBox "Le message n'a pas pu être expédié."
            On Error GoTo 0
End With | 
Partager