We have a script to backup files. After the backup operation is over, we would like to send a report as an email notification to some of our email addresses.
How could this be done?
We have a script to backup files. After the backup operation is over, we would like to send a report as an email notification to some of our email addresses.
How could this be done?
bmail. Just install the EXE and run a line like this:
bmail -s myMailServer -f [email protected] -t [email protected] -a "Production Release Performed"
Blat:
blat -to [email protected] -server smtp.example.com -f [email protected] -subject "subject" -body "body"
Easiest way is to use a third-party application as mentioned by others
If that is not an option I wrote a simple sendmail utility using vbscript & CDO which I called from a batch script
See the examples here http://www.paulsadowski.com/WSH/cdo.htm
We use blat to do this all the time in our environment. I use it as well to connect to Gmail with Stunnel. Here's the params to send a file
blat -to [email protected] -server smtp.example.com -f [email protected] -subject "subject" -body "body" -attach c:\temp\file.txt
Or you can put that file in as the body
blat c:\temp\file.txt -to [email protected] -server smtp.example.com -f [email protected] -subject "subject"
You can also use a Power Shell script:
$smtp = new-object Net.Mail.SmtpClient("mail.example.com")
if( $Env:SmtpUseCredentials -eq "true" ) {
$credentials = new-object Net.NetworkCredential("username","password")
$smtp.Credentials = $credentials
}
$objMailMessage = New-Object System.Net.Mail.MailMessage
$objMailMessage.From = "[email protected]"
$objMailMessage.To.Add("[email protected]")
$objMailMessage.Subject = "eMail subject Notification"
$objMailMessage.Body = "Hello world!"
$smtp.send($objMailMessage)