joindre un fichier avec Outlook via un script
Posté : lun. 15 oct. 2018 11:31
Bonjour j'ai un script qui me permet d'envoyer un mail déjà pré remplie mais j'aimerai y ajouter un fichier joint
voici mon code
si quelqu'un aurai la gentillesse de m'aider merci d'avance
Yohan
voici mon code
si quelqu'un aurai la gentillesse de m'aider merci d'avance
Yohan
Code : Tout sélectionner
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 267, 203, 427, 339)
$Label1 = GUICtrlCreateLabel("Envoi Du Mail", 72, 16, 120, 28)
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("A L'Atelier", 40, 40, 180, 28)
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
$Pic2 = GUICtrlCreatePic("C:\Users\Pictures\image-de-mail.jpg", 80, 72, 100, 76)
$OK = GUICtrlCreateButton("OK", 24, 152, 97, 33)
GUICtrlSetOnEvent($OK, "OK")
$Annuler = GUICtrlCreateButton("Annuler", 144, 152, 97, 33)
GUICtrlSetOnEvent($Annuler, "Annuler")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $OK
Local $olMailItem = 0
Local $olFormatRichText = 3
Local $olImportanceLow = 0
Local $olImportanceNormal = 1
Local $olImportanceHigh = 2
Local $olByValue = 1
Local $olFormatHTML = 2
Local $olFormatPlain = 1
Local $objet = "Essai"
Local $mailto = "" ; Adresse d'envoi
Local $cc = "" ; envoi copie
; envoie le mail avec outlook
$oOApp = ObjCreate("Outlook.Application")
$oOMail = $oOApp.CreateItem ($olMailItem)
$oOMail.Save
With $oOMail
.To = ($mailto)
.cc = ($cc)
.Subject = $objet
.BodyFormat = $olFormatHTML
.Importance = $olImportanceNormal
.HTMLBody = "Essai"
.Send
EndWith
$oOApp=0
Exit
Case $Annuler
Exit
EndSwitch
WEnd