So, I was finally able to get this thing to work. had to add a few lines of code to actually "add" the referenced attachment to the SMTP call. Final code that is working looks like this.
I highlighted the lines of code I added. Thanks for all the help!
Function Send-EMail {
Param (
[Parameter(`
Mandatory=$true)]
[String]$EmailTo,
[Parameter(`
Mandatory=$true)]
[String]$Subject,
[Parameter(`
Mandatory=$true)]
[String]$Body,
[Parameter(`
Mandatory=$true)]
[String]$Password,
[Parameter(`
Mandatory=$true)]
[String]$Attachment
)
$EmailFrom = "xxxx@xxxx"
$SMTPServer = "xxxx.xxxx.com"
$SMTPMessage = New-Object System.Net.Mail.MailMessage($EmailFrom,$EmailTo,$Subject,$Body)
$Att = New-Object System.Net.Mail.Attachment($Attachment)
$SMTPMessage.Attachments.add($Att)
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 25)
$SMTPClient.EnableSsl = $true
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential($EmailFrom, $Password);
$SMTPClient.Send($SMTPMessage)
Remove-Variable -Name SMTPClient
Remove-Variable -Name Password
} #End
Send-EMail -EmailTo "
xxxx@xxx.com" -Body "This is your daily automated eRx access logs delivery" -Subject "Daily eRx Logs" -Password "xxxxxxx" -Attachment "C:\ibex\utils\extract\Logs\DailyAuthReports.zip"