#RequireAdmin
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=C:\Program Files (x86)\AutoIt3\Icons\au3.ico
#AutoIt3Wrapper_Outfile=exp-imp_reg-out-cosb-serge4.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
;#region ---Au3Recorder generated code Start (v3.3.7.0) ---
#include <GUIConstantsEx.au3>
#include <File.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <ProgressConstants.au3>
;#region --- Internal functions Au3Recorder Start ---
Func _Au3RecordSetup()
Opt('WinWaitDelay',100)
Opt('WinDetectHiddenText',1)
Opt('MouseCoordMode',0)
EndFunc
Func _WinWaitActivate($title,$text,$timeout=0)
WinWait($title,$text,$timeout)
If Not WinActive($title,$text) Then WinActivate($title,$text)
WinWaitActive($title,$text,$timeout)
EndFunc
;AU3RecordSetup()
;#endregion --- Internal functions Au3Recorder End ---
#include <GUIConstantsEx.au3>
Opt('MustDeclareVars', 1)
Dim $OutPst = "c:\pst\MyPstAPX.pst" ; nom du pst exporté
Dim $Outregles = "c:\pst\MyReglesAPX.rwz" ; nom du fichier de regles exporté
Dim $outvers
Dim $loginSpie
Dim $Replace
Dim $PID
Dim $var
Dim $tosearch, $current, $Size, $Qty, $Redness, $Greeness, $Blueness, $RunOut, $Import
; check reseau et copie fichier
ProcessClose("communicator.exe")
$PID = ProcessExists("communicator.exe") ; Will return the PID or 0 if the process isn't found.
If $PID Then ProcessClose($PID)
ProcessClose("
outlook.exe")
$PID = ProcessExists("
outlook.exe") ; Will return the PID or 0 if the process isn't found.
If $PID Then ProcessClose($PID)
sleep (1000)
DirRemove("c:\temp\PST", 1)
DirRemove("c:\PST", 1)
sleep (1000)
DirCreate("c:\PST")
sleep (1000)
$var = Ping("serveur_de_partage",250)
If $var Then; also possible: If @error = 0 Then ...
SplashTextOn("VERIFICATION CONNEXION","CONNEXION OK, La copie des fichiers va commencer", 350, 100, -1, -1, 4, "", 10)
sleep (4000)
SplashOff()
Else
Msgbox(0,"CONNEXION FAILED","ERREUR, VERIFIER VOTRE CONNEXION RESEAU AVANT DE RELANCER LE SCRIPTE") ;ExitLoop
;SplashTextOn("CONNEXION FAILD","ERREUR, VERIFIER VOTRE CONNEXION RESEAU AVANT DE RELANCER LE SCRIPTE.", 350, 100, -1, -1, 4, "", 12)ExitLoop
exit
EndIf
ProgressCopy("\\serveur_de_partage\nompartage\prf\", "C:\pst\",0) ;<==l'empacement du fichier PRF
Func ProgressCopy($current, $destination, $UseMultiColour = 0, $attrib = "-R", $overwrite = 1, $Run1 = 0)
If $Run1 = 0 Then
Global $OverallQty, $Overall, $source, $overallpercent, $Progress0Text, $progressbar1, $Progress1Text, $progressbar2, $Progress2Text, $LocalPercent
DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0)
If Not FileExists($destination) Then DirCreate($destination); This is why it was failing, the dir did not exist
$source = $current
If StringRight($current, 1) = '' Then $current = StringTrimRight($current, 1)
If StringRight($destination, 1) <> '' Then $destination = $destination & "\"
$tosearch = $current
$Overall = DirGetSize($tosearch, 1)
$OverallQty = $Overall[1]
Global $PrCopyGui = GUICreate("Copie des Fichiers", 420, 100, -1, -1, -1, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST)
$Progress0Text = GUICtrlCreateLabel("Veuillez patienter", 10, 5, 400, 20, $SS_LEFTNOWORDWRAP)
$progressbar1 = GUICtrlCreateProgress(10, 20, 400, 20)
GUICtrlSetColor(-1, 32250)
$Progress1Text = GUICtrlCreateLabel("", 10, 44, 400, 20, $SS_LEFTNOWORDWRAP)
$progressbar2 = GUICtrlCreateProgress(10, 60, 400, 20, $PBS_SMOOTH)
$Progress2Text = GUICtrlCreateLabel("", 10, 82, 400, 20, $SS_LEFTNOWORDWRAP)
GUISetFont(10, 600)
GUICtrlSetColor(-1, 32250); not working with Windows XP Style if not using windows classic style or dllcall above
GUISetState(@SW_SHOW)
GUICtrlSetData($Progress1Text, "Répertoire de travail " & $tosearch)
$Run1 = 1
EndIf
$Size = DirGetSize($current, 3)
$Qty = $Size[1]
Local $search = FileFindFirstFile($current & "\*.*")
While 1
Dim $file = FileFindNextFile($search)
If @error Or StringLen($file) < 1 Then ExitLoop
If Not StringInStr(FileGetAttrib($current & "\" & $file), "D") And ($file <> "." Or $file <> "..") Then
$Qty -= 1
$LocalPercent = 100 - (($Qty / $Size[1]) * 100)
$OverallQty -= 1
$overallpercent = 100 - (($OverallQty / $Overall[1]) * 100)
GUICtrlSetData($Progress0Text, "Progression Totale " & Int($overallpercent) & "% Completer")
GUICtrlSetData($progressbar1, $overallpercent)
GUICtrlSetData($progressbar2, $LocalPercent)
GUICtrlSetData($Progress2Text, "Copie du Fichier " & $file)
If $UseMultiColour Then
GUICtrlSetColor($progressbar2, _ChangeColour($LocalPercent))
GUICtrlSetColor($progressbar1, _ChangeColour($overallpercent))
EndIf
FileCopy($current & "\" & $file, $destination & StringTrimLeft($current, StringLen($source)) & "\" & $file, $overwrite)
FileSetAttrib($destination & StringTrimLeft($current, StringLen($source)) & "\" & $file, $attrib)
EndIf
If StringInStr(FileGetAttrib($current & "\" & $file), "D") And ($file <> "." Or $file <> "..") Then
DirCreate($destination & StringTrimLeft($current, StringLen($source)) & "\" & $file)
FileSetAttrib($destination & StringTrimLeft($current, StringLen($source)) & "\" & $file, $attrib)
GUICtrlSetData($Progress1Text, $current & "\" & $file)
ProgressCopy($current & "\" & $file, $destination, $UseMultiColour, $attrib, $overwrite, 1)
EndIf
WEnd
FileClose($search)
;when overall percent = 100 set end gui text, delete gui and reset run1 to 0
If $overallpercent = 100 Then
GUICtrlSetData($Progress0Text, "Progression Totale complètée à 100%")
GUICtrlSetData($progressbar1, 100)
GUICtrlSetData($progressbar2, 100)
GUICtrlSetData($Progress2Text, "Terminer !")
Sleep(1000)
GUIDelete($PrCopyGui)
$Run1 = 0
EndIf
EndFunc ;==>ProgressCopy
Func _ChangeColour($start)
$Redness = Int(255 - ($start / 100 * 512))
If $Redness < 0 Then $Redness = 0
$Greeness = Int(($start / 100 * 512) - 257)
If $Greeness < 0 Then $Greeness = 0
$Blueness = Int(255 - ($Redness + $Greeness))
Return ($Redness * 256 * 256) + ($Greeness * 256) + $Blueness
EndFunc ;==>_ChangeColour
sleep (1000)
Choix_O()
Func Choix_O()
Local $Button_1, $Button_2,$Button_3, $msg
;GUICreate(" Choix de la version
Outlook ", 340, 120, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45, -1, 0x00000018); WS_EX_ACCEPTFILES
GUICreate(" Migration vers nouveau messagerie ", 340, 250,10,10, -1, 0x00000018); WS_EX_ACCEPTFILES
Opt("GUICoordMode", 2)
GUICtrlCreateLabel("Sélectionner l'option choisie",20 , 20, 290, 25)
$Button_1 = GUICtrlCreateButton("Export Bal et Configure",-1 , 10, 220, 40)
$Button_2 = GUICtrlCreateButton("Import PST dans bal vers nouveau messagerie",-1, 20)
$Button_3 = GUICtrlCreateButton("Quitter",-1, 30)
GUICtrlCreateLabel("Powered by COSB", -10, 15, 120, 15)
GUISetState() ; will display an dialog box with 3 button
; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $Button_1
Call ("Saisielogin")
Exit
Case $msg = $Button_2
Call ("Checkout")
Exit
Case $msg = $Button_3
ExitLoop
EndSelect
WEnd
EndFunc ;==>Choix_O
func saisielogin ()
$Replace = InputBox ("Migration vers messagerie nouveau domaine"," Veuillez saisir votre login Windows", "login", "", -1, 150, 0, 300)
;Call ("Checkout")
Select
Case $Replace = 2
call ("Choix_O")
Case $Replace <> 2
Call ("Checkout")
EndSelect
EndFunc
Func checkout () ;verification de la version
Outlook sur OS X86 et X64
if FileExists("C:\Program Files (x86)\Microsoft Office\Office14\
Outlook.exe") Then
;if FileExists("C:\Program Files (x86)\Microsoft Office\Office14\
outlook.exe") then
$outvers = "out2010"
$RunOut = '"C:\Program Files (x86)\Microsoft Office\Office14\
outlook.exe" '
MsgBox (4096, "
outlook 2010", "Outlook2010 trouvé - Ok pour continuer", 1)
call ("mytest1")
;elseif FileExists (@ProgramFilesDir & "\Microsoft Office\Office14\
Outlook.exe") Then
ElseIf FileExists ("C:\Program Files\Microsoft Office\Office14\
outlook.exe") then
$outvers = "out2010"
$RunOut = '"C:\Program Files\Microsoft Office\Office14\
outlook.exe" '
; MsgBox (4096, "
outlook 2010", "Outlook2010 trouvé - Ok pour continuer")
call ("mytest1")
elseif FileExists ("C:\Program Files (x86)\Microsoft Office\Office12\
Outlook.exe") Then
;Elseif FileExists ("C:\Program Files (x86)\Microsoft Office\Office12\
outlook.exe") then
$outvers = "out2007"
$RunOut = '"C:\Program Files (x86)\Microsoft Office\Office12\
outlook.exe" '
; MsgBox (4096, "
outlook 2007","Outlook2007 trouvé - OK pour continuer")
call ("mytest1")
elseif FileExists ("C:\Program Files\Microsoft Office\Office12\
Outlook.exe") Then
;Elseif FileExists ("C:\Program Files\Microsoft Office\Office12\
outlook.exe") then
$outvers = "out2007"
$RunOut = '"C:\Program Files\Microsoft Office\Office12\
outlook.exe" '
; MsgBox (4096, "
outlook 2007","Outlook2007 trouvé - OK pour continuer")
call ("mytest1")
Else
MsgBox(4096, "Version
Outlook", "Désolé, Aucune version
Outlook compatible n'a été trouvée")
;Call ("Choix_O")
Exit
EndIf
EndFunc
; ajout ici de la partie Cetin Copie de fichier + profil Mapi
Func mytest1 ()
MsgBox (4096, "Vérification Version
Outlook",$RunOut & $outvers & " - login Windows = " & $replace, 5)
;call ("Choix_O")
run($RunOut)
;run (@ProgramFilesDir & "\Microsoft Office\Office14\
Outlook.exe")
sleep (15000)
call ($outvers)
EndFunc
Func mytest2 ()
MsgBox (4096,"Vérification Version
Outlook",$outvers & " - login Windows = " & $replace)
;call ("Choix_O")
run($RunOut)
;run (@ProgramFilesDir & "\Microsoft Office\Office12\
Outlook.exe")
sleep (15000)
call ($outvers)
EndFunc
Func Out2010 ()
Local $Fldr1 = "c:\Temp_outlook\" ; nom du dossier temporaire
If DirGetSize($Fldr1) = -1 Then
DirCreate($Fldr1)
EndIf
; export regles
BlockInput (0) ;DéVerrouillage du clavier et de la souris
_WinWaitActivate("Boîte de réception","")
BlockInput (1)
Send("{ALTDOWN}f{ALTUP}")
sleep(500)
Send("{TAB 7}")
sleep(500)
send("{ENTER}")
; Send("{ALTDOWN}f{ALTUP}{TAB 7}{ENTER}")
_WinWaitActivate("Microsoft
Outlook","",1)
Send("{ENTER}")
_WinWaitActivate("Règles et alertes","")
Send("{ALTDOWN}o{ALTUP}")
_WinWaitActivate("Options","")
Send("{ALTDOWN}x{ALTUP}")
_WinWaitActivate("Enregistrer","")
sleep(1000)
Send("{ALT}n" & $Outregles)
Sleep (1000)
Send("{ALTDOWN}e{ALTUP}")
_WinWaitActivate("Options","")
Send("{TAB 3}{ENTER}")
_WinWaitActivate("Règles et alertes","")
Send("{ALTDOWN}{F4}{ALTUP}")
Sleep (1000)
BlockInput (0)
;Export vers pst
;BlockInput (1) ;Verrouillage du clavier et de la souris
_WinWaitActivate("Boîte de réception ","")
BlockInput (1)
Send("{ALTDOWN}fo{ALTUP}")
BlockInput (1) ;Verrouillage du clavier et de la souris
_WinWaitActivate("Options
Outlook","")
Send("{DOWN 9}{TAB 11}{ENTER}")
_WinWaitActivate("Assistant d'Importation et d'Exportation","")
Send("{UP}{UP}{ALTDOWN}s{ALTUP}")
_WinWaitActivate("Exporter vers un fichier","")
Send("{ALTDOWN}s{ALTUP}")
_WinWaitActivate("Exporter un fichier de données","")
Send("{UP}")
Sleep (1000)
Send("{ALTDOWN}s{ALTUP}")
_WinWaitActivate("Exporter un fichier de données","")
Send("{ALT}n" & $OutPst)
sleep (1000)
Send("{Enter}")
_WinWaitActivate("Création d’un fichier de données
Outlook","Ajouter un mot de pa",5)
Send("{ALTDOWN}oCE{ALTUP}{TAB}{ENTER}")
SplashTextOn("Patience", "Merci d'attendre la fermeture des fenêtres. Cela peut prendre jusqu'à 30min en fonction de la taille de la boite aux lettre.", 350, 100, -1, -1, 4, "", 12)
Sleep(20000)
_WinWaitActivate("Options
Outlook","")
;Send("{TAB 24}{ENTER}")
Send("{ALTDOWN}{F4}{ALTUP}")
SplashOff()
While FileExists ("c:\PST\~ArchivePST.pst.tmp")
SplashTextOn("Patience", "Merci d'attendre la fermeture des fenêtres. Cela peut prendre jusqu'à 30min en fonction de la taille de la boite aux lettre.", 350, 100, -1, -1, 4, "", 12)
Sleep(5000)
WEnd
BlockInput(0)
SplashOff()
MsgBox(4096,"Fin exportation","L'exportation est terminée - OK pour continuer", 1)
call ("ProfilMapi")
EndFunc
;Exit
;call ("ProfilMapi")
Func Out2007()
Local $Fldr1 = "c:\Temp_outlook\" ; nom du dossier temporaire
If DirGetSize($Fldr1) = -1 Then
DirCreate($Fldr1)
EndIf
;export règles
BlockInput (0)
_WinWaitActivate("Boîte de réception","")
BlockInput(1)
Send("{ALTDOWN}oa{ALTUP}")
;BlockInput (1) ;Verrouillage du clavier et de la souris
_WinWaitActivate("Règles et alertes","")
Send("{ALTDOWN}o{ALTUP}")
_WinWaitActivate("Options","")
Send("{ALTDOWN}x{ALTUP}")
_WinWaitActivate("Enregistrer","")
Send("{ALT}n" & $Outregles)
Sleep (1000)
Send("{ALTDOWN}e{ALTUP}")
_WinWaitActivate("Options","")
Send("{TAB 3}{ENTER}")
_WinWaitActivate("Règles et alertes","")
Send("{ALTDOWN}{F4}{ALTUP}")
Sleep (1000)
BlockInput (0)
;BlockInput (1) ;Verrouillage du clavier et de la souris
_WinWaitActivate("Boîte de réception ","")
BlockInput (1) ;Verrouillage du clavier et de la souris
Send("{ALTDOWN}fx{ALTUP}")
_WinWaitActivate("Assistant d'Importation et d'Exportation","")
Send("{UP}{UP}{ALTDOWN}s{ALTUP}")
_WinWaitActivate("Exporter vers un fichier","")
Send("{ALTDOWN}s{ALTUP}")
_WinWaitActivate("Exporter des dossiers","")
Send("{UP 4}{ALTDOWN}u{ALTUP}")
Sleep (1000)
Send("{ALTDOWN}s{ALTUP}")
_WinWaitActivate("Exporter des dossiers","")
Send("{ALT}n" & $OutPst)
sleep (1000)
Send("{Enter}")
_WinWaitActivate("Création de dossiers","")
Send("MyPstAPX{TAB 5}{ENTER}")
SplashTextOn("Patience", "Merci d'attendre la fermeture des fenêtres Cela peut prendre jusqu'à 30min en fonction de la taille de la boite aux lettre.",350, 100, -1, -1, 4, "", 12)
Sleep(20000)
SplashOff()
BlockInput(0)
While FileExists ("c:\PST\~ArchivePST.pst.tmp")
SplashTextOn("Patience", "Merci d'attendre la fermeture des fenêtres Cela peut prendre jusqu'à 30min en fonction de la taille de la boite aux lettre.", 350, 100, -1, -1, 4, "", 12)
Sleep(5000)
WEnd
Splashoff()
MsgBox(4096,"Fin exportation","L'exportation est terminée - OK pour continuer", 1)
call ("ProfilMapi")
EndFunc
;Exit
;call ("ProfilMapi")
Func ProfilMapi ()
; on peut mettre la creation de profil ici
;MsgBox (4096,"creation profil","creation")
;Exit
;;;;;;
ProcessClose("
outlook.exe")
$PID = ProcessExists("
outlook.exe") ; Will return the PID or 0 if the process isn't found.
If $PID Then ProcessClose($PID)
;$replace = InputBox("Tutorial", "Entrez votre login Windows :")
;$replace=inputbox ("login", "login")
run (@WindowsDir & "\Notepad.exe c:\pst\monPRF.prf")
sleep (500)
Send ("^h")
sleep (1500)
Send ("%spie%")
Send ("!e")
send ($replace)
sleep (500)
send ("!t")
send ("!{F4}")
send ("^s")
send ("!{F4}")
Send("#r")
WinWaitActive("Exécuter")
Send($RunOut & "/importprf C:\PST\monPRF.PRF")
Send("{Enter}")
MsgBox (4096, "INFORMATION", ' Veuillez saisir vos identifiants spie sous la forme ce\mon_login + mot de passe et cocher la case "memoriser le mot de passe" puis cliquer sur OK', 60)
;WinWaitActive("Ouverture -Microsoft
Outlook")
_WinWaitActive("[CLASS:rctrl_renwnd32]")
;_WinWaitActivate("Boîte de réception","")
;RegDelete("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment", "spie")
FileDelete("c:\pst\*.prf")
FileCopy ("c:\PST\*.*", "c:\Temp_outlook")
;;
ProcessClose("
Outlook.exe")
$PID = ProcessExists("Outloo.exe") ; Will return the PID or 0 if the process isn't found.
If $PID Then ProcessClose($PID)
Sleep(5000)
;run($Runout & "/resetfoldernames")
_WinWaitActivate("Boîte de réception","")
$Import = MsgBox(4100, "Importation","Voulez vous importer vos donnees dans votre boite aux lettres Spie?")
if $Import = "6" Then
call ("Vers_Spie")
Elseif $Import <> "6" Then
SplashTextOn( "Importation","Vous avez choisi de ne pas réimporter vos données dans votre Bal Spie. Votre PST est dans c:\Temp_outlook\ArchivePST.pst et vos régles dans c:\temp_outlook\ArchiveRegle.rwz",350, 200, -1, -1, 4, "", 10)
EndIf
Sleep (20000)
SplashOff()
ProcessClose("AutoIt3.exe")
$PID = ProcessExists("AutoIt3.exe") ; Will return the PID or 0 if the process isn't found.
If $PID Then ProcessClose($PID)
EndFunc
Exit
Func Vers_Spie ()
If $outvers = "out2010" Then
Call ("ImpOut2010")
elseif $outvers = "out2007" Then
Call ("impOut2007")
Else
ProcessClose("AutoIt3.exe")
$PID = ProcessExists("AutoIt3.exe") ; Will return the PID or 0 if the process isn't found.
If $PID Then ProcessClose($PID)
EndIf
EndFunc
Func ImpOut2010()
;BlockInput (1)
_WinWaitActivate("Boîte de réception ","")
;_WinWaitActivate("Inbox ","",2)
Send("{ALTDOWN}fo{ALTUP}")
BlockInput (1) ;Verrouillage du clavier et de la souris
_WinWaitActivate("Options
Outlook","")
Send("{DOWN 9}{TAB 11}{ENTER}")
_WinWaitActivate("Assistant d'Importation et d'Exportation","")
Send("{ALTDOWN}s{ALTUP}")
_WinWaitActivate("Importer un fichier","")
Send("{DOWN 2}{ALTDOWN}s{ALTUP}")
_WinWaitActivate("Importer un fichier","")
;Send("{ALTDOWN}h{ALTUP}" & $OutPst)
Send($OutPst)
sleep (1000)
Send("{ALTDOWN}s{ALTUP}")
_WinWaitActivate("Importer un fichier","")
;Send("{ENTER}")
Send("{TAB 7}{ENTER}")
SplashTextOn("Patience", "Merci d'attendre la fermeture des fenêtres Cela peut prendre jusqu'à 30min en fonction de la taille de la boite aux lettre.", 350, 100, -1, -1, 4, "", 12)
Sleep(10000)
_WinWaitActivate("Options
Outlook","")
;Send("{TAB 24}{ENTER}")
Send("{ALTDOWN}{F4}{ALTUP}")
BlockInput(0)
Exit
EndFunc
Func ImpOut2007()
;if FileExists ("C:\Program Files\Microsoft Office\Office12\
outlook.exe") then
; MsgBox (4096, "
outlook 2007","o2007 trouvé",10)
; ElseIf FileExists ("C:\Program Files\Microsoft Office\Office12\
outlook.exe") then
; MsgBox (4096, "
outlook 2007", "o2007 trouvé",10)
; else
; MsgBox(4096, "Version
Outlook", "Désolé,
Outlook 2007 non trouvé", 10)
; call ("Choix_O")
;EndIf
BlockInput (1)
_WinWaitActivate("Boîte de réception ","")
;_WinWaitActivate("Inbox ","",5)
Send("{ALTDOWN}fx{ALTUP}")
BlockInput (1) ;Verrouillage du clavier et de la souris
_WinWaitActivate("Assistant d'Importation et d'Exportation","")
Send("{ALTDOWN}s{ALTUP}")
_WinWaitActivate("Importer un fichier","")
Send("{DOWN 2}{ALTDOWN}s{ALTUP}")
_WinWaitActivate("Importer des dossiers","Fichier à importer")
Send($OutPst)
sleep (1000)
Send("{ALTDOWN}s{ALTUP}")
_WinWaitActivate("Importer des dossiers","")
Send("{TAB 7}{ENTER}")
SplashTextOn("Patience", "Merci d'attendre la fermeture des fenêtres Cela peut prendre jusqu'à 30min en fonction de la taille de la boite aux lettre.", 350, 100, -1, -1, 4, "", 10)
Sleep(10000)
BlockInput(0)
EndFunc
;
;##################################
; Include
;##################################
#Include<file.au3>
;##################################
; Variables
;##################################
$SmtpServer = "vhcgroupe.groupe.loc" ; address for the smtp-server to use - REQUIRED
$FromName = "Administrateur" ; name from who the email was sent
$FromAddress = "
Administrateur@mondomaine.com" ; address from where the mail should come
$ToAddress = @username & @mondomaine.com" ; destination address of the email - REQUIRED
$Subject = "INFORMATION EMPLACEMENT PST SAUVEGARDE" ; subject from the email - can be anything you want it to be
$Body = "Votre PST est sauvegardé à l'emplacement suivant :" & @CRLF & "C:\PST\ArchivePST.pst"& @CRLF & @CRLF & "Et une copie de vos règles l'emplacement suivant :" & @CRLF & "C:\PST\ArchiveRegles." & @CRLF &@CRLF &"VEUILLEZ NE PAS REPONDRE A CE MAIL" & @CRLF &"MERCI" ; the messagebody from the mail - can be left blank but then you get a blank mail
$AttachFiles = "" ; the file(s) you want to attach seperated with a ; (Semicolon) - leave blank if not needed
$CcAddress = "" ; address for cc - leave blank if not needed
$BccAddress = "" ; address for bcc - leave blank if not needed
$Importance = "Normal" ; Send message priority: "High", "Normal", "Low"
$Username = "Administrateur" ; username for the account used from where the mail gets sent - REQUIRED
$Password = "**********" ; password for the account used from where the mail gets sent - REQUIRED
$IPPort = 25 ; port used for sending the mail
$ssl = 0 ; enables/disables secure socket layer sending - put to 1 if using httpS
;~ $IPPort=465 ; GMAIL port used for sending the mail
;~ $ssl=1 ; GMAILenables/disables secure socket layer sending - put to 1 if using httpS
;##################################
; Script
;##################################
Global $oMyRet[2]
Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
$rc = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl)
If @error Then
MsgBox(0, "Error sending message", "Error code:" & @error & " Description:" & $rc)
EndIf
;
; The UDF
Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Importance="Normal", $s_Username = "", $s_Password = "", $IPPort = 25, $ssl = 0)
Local $objEmail = ObjCreate("CDO.Message")
$objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>'
$objEmail.To = $s_ToAddress
Local $i_Error = 0
Local $i_Error_desciption = ""
If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress
If $s_BccAddress <> "" Then $objEmail.Bcc = $s_BccAddress
$objEmail.Subject = $s_Subject
If StringInStr($as_Body, "<") And StringInStr($as_Body, ">") Then
$objEmail.HTMLBody = $as_Body
Else
$objEmail.Textbody = $as_Body & @CRLF
EndIf
$objEmail.Configuration.Fields.Item ("
http://schemas.microsoft.com/cdo/config ... /sendusing") = 2
$objEmail.Configuration.Fields.Item ("
http://schemas.microsoft.com/cdo/config ... smtpserver") = $s_SmtpServer
If Number($IPPort) = 0 then $IPPort = 25
$objEmail.Configuration.Fields.Item ("
http://schemas.microsoft.com/cdo/config ... serverport") = $IPPort
;Update settings
$objEmail.Configuration.Fields.Update
; Set Email Importance
Switch $s_Importance
Case "High"
$objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "High"
Case "Normal"
$objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Normal"
Case "Low"
$objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Low"
EndSwitch
$objEmail.Fields.Update
; Sent the Message
$objEmail.Send
If @error Then
SetError(2)
Return $oMyRet[1]
EndIf
$objEmail=""
EndFunc ;==>_INetSmtpMailCom
Exit