So I did this to send and it worked with powershell.
Now I have to find a way to combine all 3 into 1.
1. .bat to query data
2. .ps1 to send data
3. Start services for both above to run daily
$fromaddress="
[email protected]"
$toaddress="
[email protected]"
$Subject="testing Files"
$body="Just testing my coding outside of .pl"
$attachment="C:\Temp\TEST.csv"
$smtpserver="mail.google.com"
####################################
$message=new-objectSystem.Net.Mail.MailMessage
$message.From =$fromaddress
$message.To.Add($toaddress)
$message.Subject =$Subject
$attach=new-objectNet.Mail.Attachment($attachment)
$message.Attachments.Add($attach)
$message.body =$body
$smtp=new-objectNet.Mail.SmtpClient($smtpserver)
$smtp.Send($message)