Jump to content

passing an Array to a function (files to mailer)


Skysnake
 Share

Recommended Posts

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?

Link to comment
Share on other sites

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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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...