Aide et conseils concernant AutoIt et ses outils.
jcaspar
Niveau 7
Messages : 449 Enregistré le : mar. 23 sept. 2008 17:58
Status :
Hors ligne
#1
Message
par jcaspar » mer. 03 juin 2009 17:41
B
onjour à tous !
Pardon pour le précédent message ou j'ai oublié les règles de présentation ( la chaleur tape sur mon seul neurone survivant lol)
Je souhaiterais envoyer un message en utilisant exchange sachant qu'il faut taper son identifiant , son mot de passe au préalable
quelqu'un a il réussi à faire cela avec autoit ?
Merci à tous pour vos suggestions
Jean Marc
jbnh
Niveau 11
Messages : 1932 Enregistré le : ven. 02 mai 2008 14:54
Localisation : Bruxelles
Status :
Hors ligne
#2
Message
par jbnh » mer. 03 juin 2009 19:22
Le mieux est encore d'éditer son ancien post et rajouter la balise que de créer un nouveau.
Balise [..] devant votre requête en cours, [R] quand résolu | Pas de message concernant les bots !
Merci
jl56
Niveau 7
Messages : 415 Enregistré le : mer. 24 oct. 2007 22:42
Localisation : 56000
Status :
Hors ligne
#3
Message
par jl56 » mer. 03 juin 2009 21:03
Bonjour
Oui
tu trouveras ici un code qui fonctionne ( il faut l'adapter a ton environnement )
► Afficher le texte
Code : Tout sélectionner
#include <File.au3>
#include <Inet.au3>
Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
Global $oMyRet[2]
Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
Global $i
for $i=1 to 1
_INetSmtpMailCom()
sleep (30000)
next
_INetSmtpMailCom()
Exit
Func _INetSmtpMailCom()
$s_Subject = $i&" email via exchange"
$s_CcAddress = ""
$s_SmtpServer="ipduserveur exchange"
;~ MsgBox(0, " email", $s_SmtpServer)
$s_FromName="test2"
$s_FromAddress="jl56@exchange.fr"
$s_ToAddress="jl56"
$s_Username="jl56@mondomaine.locale"
$s_Password="password"
$as_Body = "corps du message"
$s_AttachFiles = "";"" ; the file you want to attach- leave blank if not needed
$s_BccAddress = "" ; address for bcc - leave blank if not needed
$IPPort=25
if $IPPort=465 then $ssl=1
;~ MsgBox(0,"ssl",$ssl)
$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
If $s_AttachFiles <> "" Then
Local $S_Files2Attach = StringSplit($s_AttachFiles, ";")
For $x = 1 To $S_Files2Attach[0]
$S_Files2Attach[$x] = _PathFull ($S_Files2Attach[$x])
If FileExists($S_Files2Attach[$x]) Then
$objEmail.AddAttachment ($S_Files2Attach[$x])
Else
$i_Error_desciption = $i_Error_desciption & @lf & 'File not found to attach: ' & $S_Files2Attach[$x]
SetError(1)
return 0
EndIf
Next
EndIf
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort
;Authenticated SMTP
If $s_Username <> "" Then
;~ MsgBox(0," $s_Username",$s_Username)
;~ MsgBox(0," $s_Password",$s_Password)
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password
EndIf
If $Ssl Then
;~ MsgBox(0,"ssl ok",$ssl)
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1
EndIf
;Update settings
$objEmail.Configuration.Fields.Update
; Sent the Message
$objEmail.Send
if @error then
SetError(2)
return $oMyRet[1]
EndIf
EndFunc ;==>_INetSmtpMailCom*$
Func MyErrFunc()
$HexNumber = Hex($oMyError.number, 8)
$oMyRet[0] = $HexNumber
$oMyRet[1] = StringStripWS($oMyError.description,3)
MsgBox (0,"### erreur d'envoie de la notificaton "," ! Numéro: " & $HexNumber & " ligne du script: " & $oMyError.scriptline & " Description:" & $oMyRet[1] & @LF,20)
SetError(1); something to check for when this function returns
Return
EndFunc ;==>MyErrFunc
A+ JL56
jcaspar
Niveau 7
Messages : 449 Enregistré le : mar. 23 sept. 2008 17:58
Status :
Hors ligne
#4
Message
par jcaspar » ven. 05 août 2011 21:58
Merci pour cette réponse !
Tlem
Site Admin
Messages : 11823 Enregistré le : ven. 20 juil. 2007 21:00
Localisation : Bordeaux
Status :
Hors ligne
#5
Message
par Tlem » sam. 06 août 2011 04:10
N'oubliez pas la balise [R] dans le titre de votre premier message si votre sujet est résolu.