Sign in to follow this  
Followers 0
squidly

Using Autoit to email .snp reports

1 post in this topic

#1 ·  Posted (edited)

Hello all,

I am attempting to email some Access reports using the _INetSmtpMailCom function. My script connects to a db, compiles the email list from a query, and then I need to attach a report, which is where I am getting hung up. I can compile the email list, and execute an email without said attachment. Here is a sample script I used to get started...

Local $oRS
Local $oConn
$tempfile = @TempDir & '\Emaillist.txt'
$location = @ScriptDir & "\MyDatabase.mdb"
If FileExists($tempfile) then FileDelete($tempfile)



$oConn = ObjCreate("ADODB.Connection")
$oRS = ObjCreate("ADODB.Recordset")
$oConn.Open("Driver={Microsoft Access Driver (*.mdb)};Dbq="&$location)
$oRS.Open("Select * FROM Table1", $oConn, 1, 3)
$oRS.MoveFirst

;Used to compile the email list from Table1
For $iIndex = 1 To $oRS.RecordCount
    IF $oRS.Fields("Checkbox1").value = -1 Then
        $message = $oRS.Fields("Email").value
        FileWriteLine($tempfile,$message)
    EndIf
    $oRS.MoveNext
Next

$oConn.Close
$oConn = 0

I also included the sample db. Anyway to save the .snp file to the tempdir?

Thanks in advance!

MyDatabase.zip

Edited by squidly

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