[PowerShell] Send email from Gmail with attachment on PowerShell

Credits goes to 

I modified the script a little bit to pick up the log from c:\temp\ daily where the filename is made up of yyyymmdd

$a = Get-Date -Format yyyyMMdd

$smtpClient = new-object 
$smtpClient.Host = ''
$smtpClient.Port = 587
$smtpClient.EnableSsl = $true
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential("", "password");

$emailFrom = ""
$emailTo = ","
$Subject = "Backup log for " +$a
$Body = "Please refer to attached logfile."

$emailMessage = New-Object System.Net.Mail.MailMessage
$emailMessage.From = $EmailFrom
$emailMessage.Subject = $Subject
$emailMessage.Body = $Body
$emailMessage.Attachments.Add("C:\temp\libra_backup"+ $a+".txt")


For more information on Get-Date format, please click here