Sign in to follow this  
Followers 0
Skysnake

passing an Array to a function (files to mailer)

4 posts in this topic

#1 ·  Posted (edited)

I have built an array with FileListtoArray (pretty neat, discovered this after writing all of it the long way....) - now I want to pass this Array to the mailer - function call to _INetSmtpMailCom

Problem is I do not want to call the _INetSmtpMailCom for each instance in the Array.

-> This is the question: I read somewhere (AutoIt Help/Forum?) that [paraphrase] you can pass an Array to a Function and it will repeat until all items in Array have been processed, but first item in Array must... [something] - and this is where I get stuck. Could someone please point me in the right direction? I need to see where to look, or alternate see a little piece of code that shows how I feed my FileListArray to _INetSmtpMailCom - please?

Skysnake

Edited by Skysnake

Skysnake

Why is the snake in the sky?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

If you want to send a single mail and attach all the files in the array to this mail then this should work:

$s_AttachFiles = _ArrayToString($yourArray,";",1) ; 1 means that the array has the number of records in element 0
_INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, $s_AttachFiles)

Taken from the UDF:

$AttachFiles = "" ; the file(s) you want to attach seperated with a ; (Semicolon) - leave blank if not needed
Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Thanks, I try tonight, reply on Monday. Cheers


Skysnake

Why is the snake in the sky?

Share this post


Link to post
Share on other sites

The reference I mis-remembered was in the AutoIT help for Call(). Anyway I put it into a FOR/NEXT loop and have achieved what I wanted, thanks.

Skysnake


Skysnake

Why is the snake in the sky?

Share this post


Link to post
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
Sign in to follow this  
Followers 0