Jump to content

[solved] send multiple files by email from a file list


 Share

Recommended Posts

Hi! I want to send by mail some files with a certain extension (.xml in my case). These files are located in the script folder. First, I thought to use _FileListToArrayRec function to have a list of these files. But than I don't know how to send them all at once. I know that I can attach multiple files in this way: path1;path2;path3; etc.  and so I have tried to make a string of this type with the path of the files (with a for loop) but It doesn't attach any file (only instructions.txt). How could I do? ( what I did is just an idea, if there's something better that would be great) Thanks!

$aArrayXml = _FileListToArrayRec(@ScriptDir, "*.xml", $FLTAR_FILES)
_ArrayDisplay($aArrayXml, "LIST XML")
$LenghtArrayXml = UBound($aArrayXml)

If ($LenghtArrayXml > 2) Then
    For $i = 2 To $LenghtArrayXml - 1
        $temp = "&@ScriptDir&""\"&$aArrayXml[$i]&";"&""""
        $XmlListFile = $XmlListFile & $temp
    Next
EndIf

$XmlListFile = StringTrimLeft($XmlListFile, 1)

if($LenghtArrayXml = 2)Then
    $rc =_INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, @ScriptDir&"\"&$aArrayXml[1]&";"&@ScriptDir&"\instructions.txt", $s_CcAddress, $s_BccAddress, $s_Username, $s_Password, $IPPort, $ssl)
Else
    $rc = _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, @ScriptDir&"\"&$aArrayXml[1]&$XmlListFile&@ScriptDir&"\instructions.txt", $s_CcAddress, $s_BccAddress, $s_Username, $s_Password, $IPPort, $ssl)
EndIf

 

Edited by Rapidnxit
solved
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

×
×
  • Create New...