Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
# micros report emailer version 2.0
# no blat, no stunnel, powershell only
# final destination
# written by mcuiffi@proton.me
# directory and file naming
# yesterday calculates yesterday's date and formats it to not have any spaces
# shouldn't need to change this one
#
# rptpath is the directory that micros uses to generate reports to pdfs, with a wildcard to grab all pdfs in that folder
# example: "C:\PDFReports\*.pdf"
#
# zippath is the directory for compressing all the report pdfs into a zip file
# example: "D:\Emailer\archives"
#
# zipname is the name of the zip that's created, add the name before the $yesterday variable
# example: "Micros_CC_$yesterday"
$yesterday = (Get-Date).AddDays(-1).ToString('MM-dd-yyyy')
$rptpath = "D:\ReportEmailer\*.pdf"
$zippath = "D:\ReportEmailer\archives"
$zipname = "EOD Reports $yesterday"
Compress-Archive -Path $rptpath -DestinationPath "$zippath$zipname"
# Sender and Recipient Info
$MailFrom = ""
$MailTo = ""
# CC Info
# if multiple recipients are needed, you can configure them here
# not sure how to put them all in one variable yet so if more than one cc is needed, you can duplicate the line and increment the variable name
# just make sure to delete the # at the start of the line
#$MailCC1 = "cc email 1 address here"
#$MailCC2 = "cc email 2 address here"
#$MailCC3 = "cc email 3 address here"
#and so on
# Sender Credentials
$Username = ""
$Password = ""
# Server Info
$SmtpServer = "smtp.gmail.com"
$SmtpPort = "587"
# Message stuff
# same thing with using cc here, duplicate lines and delete # as needed
$MessageSubject = "Daily EOD Reports $yesterday"
$Message = New-Object System.Net.Mail.MailMessage $MailFrom,$MailTo
$Message.Subject = $MessageSubject
#$Message.cc.Add($MailCC1)
#$Message.cc.Add($MailCC2)
#$Message.cc.Add($MailCC3)
#and so on
$Message.Attachments.Add("$zippath$zipname.zip")
# Construct the SMTP client object, credentials, and send
# basically don't worry about this block at all
$Smtp = New-Object Net.Mail.SmtpClient($SmtpServer,$SmtpPort)
$Smtp.EnableSsl = $true
$Smtp.Credentials = New-Object System.Net.NetworkCredential($Username,$Password)
$Smtp.Send($Message)
Remove-Item D:\ReportEmailer\*.pdf