Jump to content

Search a file and includ them in a mail


Recommended Posts

Hello I need some help ,

The situation is : We know exactly the Name and extension of the file . For example , the file is called : blabla.txt . But we don't know the adress of the file . So the script search the file in all drives and when he found the file , he take the adress . For example : C:\Documents and Settings\blabla.txt .

When he have the adress he give the information ( adress of the join file ) . I write in red under .

And Then the script send the mail with the joined file ! Thanks for your help.

I have the part for the mail ,but not the part to know the adress of the file.

#Include<file.au3>

Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")

;##################################

; Include

;##################################

#Include<file.au3>

;##################################

; Variables

;##################################

$s_SmtpServer = "MailServer" ; address for the smtp-server to use - REQUIRED

$s_FromName = "Name" ; name from who the email was sent

$s_FromAddress = "your@Email.Address.com" ; address from where the mail should come

$s_ToAddress = "your@Email.Address.com" ; destination address of the email - REQUIRED

$s_Subject = "Userinfo" ; subject from the email - can be anything you want it to be

$as_Body = "" ; the messagebody from the mail - can be left blank but then you get a blank mail

$s_AttachFiles = "C:\Documents and Settings\blabla.txt" ; They give the adress ( acess) of the file and then they send the mail with joined file the file you want to attach- leave blank if not needed

$s_CcAddress = "CCadress1@test.com" ; address for cc - leave blank if not needed

$s_BccAddress = "BCCadress1@test.com" ; address for bcc - leave blank if not needed

$s_Username = "******" ; username for the account used from where the mail gets sent - Optional (Needed for eg GMail)

$s_Password = "********" ; password for the account used from where the mail gets sent - Optional (Needed for eg GMail)

$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($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, $s_AttachFiles, $s_CcAddress, $s_BccAddress, $s_Username, $s_Password, $IPPort, $ssl)

If @error Then

MsgBox(0, "Error sending message", "Error code:" & @error & " Rc:" & $rc)

EndIf

;

Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Username = "", $s_Password = "",$IPPort=25, $ssl=0)

$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

$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

$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True

EndIf

;Update settings

$objEmail.Configuration.Fields.Update

; Sent the Message

$objEmail.Send

if @error then

SetError(2)

return $oMyRet[1]

EndIf

EndFunc ;==>_INetSmtpMailCom

;

;

; Com Error Handler

Func MyErrFunc()

$HexNumber = Hex($oMyError.number, 8)

$oMyRet[0] = $HexNumber

$oMyRet[1] = StringStripWS($oMyError.description,3)

ConsoleWrite("### COM Error ! Number: " & $HexNumber & " ScriptLine: " & $oMyError.scriptline & " Description:" & $oMyRet[1] & @LF)

SetError(1); something to check for when this function returns

Return

EndFunc ;==>MyErrFunc

Edited by Fanatick
Link to comment
Share on other sites

It's not for key logger , and Why would I make a key logger? Many many key loggers exist and it's easy to find in network. And i don't use that shit.

If someone can help me ty

Edited by Fanatick
Link to comment
Share on other sites

well you "just" have to look at _FileListToArrayEx with recurse option on all drives then you get your file.

to get all fixed drives :

$a_Drives = DriveGetDrive("FIXED")
$msg = ""
For $i = 1 to $a_Drives[0]
    $msg = $msg & $a_Drives[$i] & @CR
Next
MsgBox(0,"Disk list",$msg)oÝ÷ ØX¥x¸¬µ:®¶²¬jÞ¶Ü ¢_ºw-Ú±ö«j̨¹Ú'ßÛaj÷¢·¢y^¶×«²X¤zâúÞÈl ay"·lmëmz»hºÇ­+-©ñ¶qú+¶¬·µ§]¢v®¶­sc³ÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓУ°£²FW67&Föã¢Æ7G2ÆÂ÷"&VfW'&VBfÆW2æB÷"föÆFW'2â7V6fVBF$T5U%4dTÅ6ÖÆ"FòW6ærF"vFFRô"7vF6£²7çF¢ôfÆTÆ7EFô'&Wb33c·5FÂb33c·4fÇFW"Òb33²¢â¢b33²Âb33c¶fÆrÒÂb33c·4W6ÇVFRÒb33²b33²Âb33c¶&V7W'6RÒfÇ6R£²&ÖWFW"2¢b33c·5FÒFFòvVæW&FRfÆVÆ7Bf÷ £²b33c·4fÇFW"ÒFRfÇFW"FòW6Râ6V&6FRWFöC2ÖçVÂf÷"FRv÷&BgV÷CµvÆD6&G2gV÷C²f÷"FWFÇ2Â7W÷'Bæ÷rf÷"×VÇFÆR6V&6W0£²W×ÆR¢æWS²¢çGBvÆÂfæBÆÂæWRæBçGBfÆW0£²b33c¶fÆrÒFWFW&ÖæW2vVFW"Fò&WGW&âfÆR÷"föÆFW'2÷"&÷Fࣲb33c·4W6ÇVFRÒW6ÇVFRfÆRg&öÒFRÆ7B'ÆÂ÷"'BöbG2æÖRâæ÷r÷R6âW6R×VÇFÆRW6ÇVFW2vFvF÷"röòvÆF6&G2ࣲW×ÆS¢Væç2¢vÆÂ&VÖ÷fRÆÂfÆW2öföÆFW'2FB7F'BvFVæç0£²b33c¶fÆsÓFVfVÇB&WGW&â&÷FfÆW2æBföÆFW'0£²b33c¶fÆsÓ&WGW&âfÆW2öæÇ£²b33c¶fÆsÓ"&WGW&âföÆFW'2öæÇ£²b33c¶&V7W'6RÒG'VRÒ&V7W'6fRÂfÇ6RÒ7FæF&@£°£²&WV&VÖVçB2¢æöæP£²&WGW&âfÇVR2¢öâ7V66W72Ò&WGW&ç2â'&6öçFæærFRÆ7BöbfÆW2æBföÆFW'2âFR7V6fVBF£²öâfÇW&RÒ&WGW&ç2FRâV×G7G&ærgV÷C²gV÷C²bæòfÆW2&Rf÷VæBæB6WG2W'&÷"öâW'&÷'0£²W'&÷"÷"WFVæFVBÒFæ÷Bf÷VæB÷"çfÆ@£²W'&÷"÷"WFVæFVBÒ"çfÆBb33c·4fÇFW"÷"çfÆBb33c·4W6ÇVFP£²W'&÷"÷"WFVæFVBÒ2çfÆBb33c¶fÆp£²W'&÷"÷"WFVæFVBÒBæòfÆR2f÷Væ@£°£²WF÷"2¢6Ôö¶Uôࣲæ÷FR2¢FR'&&WGW&æVB2öæRÖFÖVç6öæÂæB2ÖFRW2föÆÆ÷w3 £²b33c¶'&³ÒÒçVÖ&W"öbfÆW2b3#´föÆFW'2&WGW&æV@£²b33c¶'&³ÒÒ7BfÆRb3#´föÆFW £²b33c¶'&³%ÒÒ&æBfÆRb3#´föÆFW £²b33c¶'&³5ÒÒ7&BfÆRb3#´föÆFW £²b33c¶'&¶åÒÒçFfÆRb3#´föÆFW £°£²ÆÂfÆW2&Rw&GFVâFògV÷C·&W6W'fVBgV÷C²çF×fÆRFæ·2Fòvg&÷7Bf÷"FRW×ÆP£²FR&W6W'fVBfÆR2FVâ&VBçFòâ'&ÂFVâFVÆWFV@£³ÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÐ ¤gVæ2ôfÆTÆ7EFô'&W"b33c·5FÂb33c·4fÇFW"Òb33²¢â¢b33²Âb33c¶fÆrÒÂb33c·4W6ÇVFRÒb33²b33²Âb33c¶&V7W'6RÒfÇ6R¢bæ÷BfÆTW7G2b33c·5FFVâ&WGW&â6WDW'&÷"ÂÂb33²b33²¢bb33c·4fÇFW"ÒÓ÷"b33c·4fÇFW"ÒFVfVÇBFVâb33c·4fÇFW"Òb33²¢â¢b33°¢bb33c¶fÆrÒÓ÷"b33c¶fÆrÒFVfVÇBFVâb33c¶fÆrÒ¢bb33c·4W6ÇVFRÒÓ÷"b33c·4W6ÇVFRÒFVfVÇBFVâb33c·4W6ÇVFRÒb33²b33°¢Æö6Âb33c¶&D6%³eÒÒ²b33²b3#²b33²Âb33²òb33²Âb33³¢b33²Âb33²fwC²b33²Âb33²fÇC²b33²Âb33·Âb33µÐ¢b33c·4fÇFW"Ò7G&æu&VtW&WÆ6Rb33c·4fÇFW"Âb33²b3#·2£²b3#·2¢b33²Âb33³²b33²¢b7G&æu&vBb33c·5FÂfÇC²fwC²b33²b3#²b33²FVâb33c·5Ff׳Òb33²b3#²b33°¢f÷"b33c¶42ÒFòP¢b7G&ætå7G"b33c·4fÇFW"Âb33c¶&D6%²b33c¶45Ò÷"ð¢7G&ætå7G"b33c·4W6ÇVFRÂb33c¶&D6%²b33c¶45ÒFVâ&WGW&â6WDW'&÷""Â"Âb33²b33²¢æW@¢b7G&æu7G&u2b33c·4fÇFW"ÂÒb33²b33²FVâ&WGW&â6WDW'&÷""Â"Âb33²b33²¢bæ÷Bb33c¶fÆrÒ÷"b33c¶fÆrÒ÷"b33c¶fÆrÒ"FVâ&WGW&â6WDW'&÷"2Â2Âb33²b33²¢Æö6Âb33c¶ôe4òÒö&¤7&VFRgV÷Cµ67&FæräfÆU77FVÔö&¦V7BgV÷C²Âb33c·5DföÆFW ¢b33c·5DföÆFW"Òb33c¶ôe4òävWE7V6ÄföÆFW""¢Æö6Âb33c¶÷WDfÆRÒFV×F"fײb33c¶ôe4òävWEFV×æÖP¢bæ÷B7G&ætå7G"b33c·4fÇFW"Âb33³²b33²FVâb33c·4fÇFW"f׳Òb33³²b33°¢Æö6Âb33c¶7ÆBÒ7G&æu7ÆB7G&æu7G&u2b33c·4fÇFW"ÂÂb33³²b33²Âb33c·5&VBÂb33c·4öÆE7Æ@¢f÷"b33c¶42ÒFòb33c¶7ÆE³Ð¢b7G&æu7G&u2b33c¶7ÆE²b33c¶45ÒÃÒb33²b33²FVâ6öçFçVTÆö÷¢b7G&ætÆVgBb33c¶7ÆE²b33c¶45ÒÂÒb33²âb33²æBð¢T&÷VæB7G&æu7ÆBb33c¶7ÆE²b33c¶45ÒÂb33²âb33²Ò"ÒFVâb33c¶7ÆE²b33c¶45ÒÒb33²¢b33²fײb33c¶7ÆE²b33c¶45Тb33c·4öÆE7ÆBf׳Òb33²gV÷C²b33²fײb33c·5Ffײb33c¶7ÆE²b33c¶45Òfײb33²gV÷C²b33°¢æW@¢b33c·4öÆE7ÆBÒ7G&æuG&Õ&vBb33c·4öÆE7ÆB¢¢bb33c¶&V7W'6RFVà¢'VåvB6ö×7V2fײb33²ö2F"ö"÷2öb33²fײb33c·4öÆE7ÆBfײb33²fwC²gV÷C²b33²fײb33c¶÷WDfÆRfײb33²gV÷C²b33²Âb33²b33²Â5uôDR¢VÇ6P¢'VåvB6öÕ7V2fײb33²ö2F"ö"öb33²fײb33c·4öÆE7ÆBfײb33²öòÖRööBfwC²gV÷C²b33²fײb33c¶÷WDfÆRfײb33²gV÷C²b33²Âb33²b33²Â5uôDR¢VæD`¢b33c·5&VBf׳ÒfÆU&VBb33c¶÷WDfÆR¢bæ÷BfÆTW7G2b33c¶÷WDfÆRFVâ&WGW&â6WDW'&÷"BÂBÂb33²b33²¢fÆTFVÆWFRb33c¶÷WDfÆR¢b7G&æu7G&u2b33c·5&VBÂÒb33²b33²FVâ6WDW'&÷"BÂBÂb33²b33²¢Æö6Âb33c¶e7ÆBÒ7G&æu7ÆB7G&æuG&Õ&vB7G&æu7G&5"b33c·5&VBÂÂÄb¢Æö6Âb33c·4öÆBÂb33c¶ôç6dæÖP¢f÷"b33c¶42ÒFòb33c¶e7ÆE³Ð¢²G&ç6ÆFRDõ2fÆVæÖW2g&öÒôTÒFòå4¢b33c¶ôç6dæÖRÒFÆÄ6ÆÂb33·W6W#3"æFÆÂb33²Âb33´çBb33²Âb33´öVÕFô6"b33²Âb33·7G"b33²Âb33c¶e7ÆE²b33c¶45ÒÂb33·7G"b33²Âb33²b33²¢bW'&÷#ÓFVâb33c¶e7ÆE²b33c¶45ÒÒb33c¶ôç6dæÖU³%Ð ¢bb33c·4W6ÇVFRæB7G&ætÆVgBb33c¶e7ÆE²b33c¶45ÒÂð¢7G&ætÆVâ7G&æu&WÆ6Rb33c·4W6ÇVFRÂb33²¢b33²Âb33²b33²Ò7G&æu&WÆ6Rb33c·4W6ÇVFRÂb33²¢b33²Âb33²b33²FVâ6öçFçVTÆö÷¢7vF6b33c¶fÆp¢66R¢b7G&æu&VtWb33c¶e7ÆE²b33c¶45ÒÂb33²b3#·s¢b3#²b3#²b33²ÒFVà¢b33c·4öÆBf׳Òb33c·5Ffײb33c¶e7ÆE²b33c¶45Òfײ6"¢VÇ6P¢b33c·4öÆBf׳Òb33c¶e7ÆE²b33c¶45Òfײ6"¢VæD`¢66R¢b7G&ætå7G"fÆTvWDGG&"b33c·5Ffײb33²b3#²b33²fײb33c¶e7ÆE²b33c¶45ÒÂb33¶Bb33²ÒæBð¢7G&ætå7G"fÆTvWDGG&"b33c¶e7ÆE²b33c¶45ÒÂb33¶Bb33²ÒFVà¢b7G&æu&VtWb33c¶e7ÆE²b33c¶45ÒÂb33²b3#·s¢b3#²b3#²b33²ÒFVà¢b33c·4öÆBf׳Òb33c·5Ffײb33c¶e7ÆE²b33c¶45Òfײ6"¢VÇ6P¢b33c·4öÆBf׳Òb33c¶e7ÆE²b33c¶45Òfײ6"¢VæD`¢VæD`¢66R ¢b7G&ætå7G"fÆTvWDGG&"b33c·5Ffײb33²b3#²b33²fײb33c¶e7ÆE²b33c¶45ÒÂb33¶Bb33²÷"ð¢7G&ætå7G"fÆTvWDGG&"b33c¶e7ÆE²b33c¶45ÒÂb33¶Bb33²FVà¢b7G&æu&VtWb33c¶e7ÆE²b33c¶45ÒÂb33²b3#·s¢b3#²b3#²b33²ÒFVà¢b33c·4öÆBf׳Òb33c·5Ffײb33c¶e7ÆE²b33c¶45Òfײ6"¢VÇ6P¢b33c·4öÆBf׳Òb33c¶e7ÆE²b33c¶45Òfײ6"¢VæD`¢VæD`¢VæE7vF6¢æW@¢b7G&æuG&Õ&vBb33c·4öÆBÂFVâ&WGW&â7G&æu7ÆB7G&æuG&Õ&vBb33c·4öÆBÂÂ6"¢&WGW&â6WDW'&÷"BÂBÂb33²b33²¤VæDgVæ0oÝ÷ Û*.q©î±è­)¶¬jëh×6$s_Path = $mydrive
$a_List = _FileListToArrayEx2($s_Path, "*.*", 0, "",True)
If @error Then Exit
For $i = 1 To $a_List[0]
    ConsoleWrite($a_List[$i] & @CR)
Next

you just have to make a little (really, really small) mix of it to have your script

Edit : try to ad url to aec profile but

[post=url]aec[/post]
didn't work Edited by baghenamoth
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...