Using string representation of dates is hardly ever a good idea.
Using the example @Andreas Baumgarten posted, here's a safer way:
$today = (Get-Date).Date
$Script:Success = $false
Get-ChildItem -Path .\Junk -File |
ForEach-Object {
if ($_.LastWriteTime.Date -eq $today) {
$Script:Success = $true
}
}
if ($Script:Success){
Send-MailMessage -SmtpServer mail.server.local -Subject "Backup Success" -From noreply@noreply.com -To me@domain.com
}
else{
Send-MailMessage -SmtpServer mail.server.local -Subject "Backup Failed" -From msweb-oma_noreply@noreply.com -To me@domain.com
}
Edit: added code to send an email tailored to the success or failure to find a file written "today".