views:

2202

answers:

5

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?

+3  A: 

bmail. Just install the EXE and run a line like this:

bmail -s myMailServer -f [email protected] -t [email protected] -a "Production Release Performed"
RossFabricant
Here I cant install bamil as per security purpose. plz tell me is there any alernate way to solve my problem.
Have you tried with other command-line email clients? A Google search lists quite many freely available tools.
0xA3
+6  A: 

Blat:

blat -to [email protected] -server smtp.example.com -f [email protected] -subject "subject" -body "body"
Colin Pickard
+2  A: 

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

laurie
+1  A: 

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"
Keng
+1  A: 

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)
Philibert Perusse