• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 474
  • Last Modified:

Set outlook to send me a daily log file

I want to setup an automated email to my personal email address that is sent by Outlook from the server. I'm testing a robocopy job that generates a log file. I want outlook to send me the daily log file. i'd like to ad send mail commands to this cmd file so everything runs at once.

Here is the test robocopy batch file that creates a log named Robo-Today.txt

###
### Working copy with good file name  - mm/dd/yyyy
###
echo %date:~-4,4%
echo %date:~-7,2%
echo %date:~-10,2%
###
set yr=%date:~-4,4%
set mo=%date:~-7,2%
set dy=date:~-10,2%
set f2=%date:~-10,2%-%date:~-7,2%-%date:~-4,4%
###
echo %f2%
set fn=robo-%f2%.txt
###
robocopy.exe f:\ x:\ *.txt /E /SEC /NP /COPYALL /Log:%fn%
copy %fn% Robo-Today.txt
 
0
Tony Giangreco
Asked:
Tony Giangreco
  • 4
  • 4
2 Solutions
 
Aaron TomoskySD-WAN SimplifiedCommented:
Batch file emails are pretty rare. Usually people go vbscript or powershell. However here is one I found
http://www.robvanderwoude.com/email.php

Untested.
0
 
ReneGeCommented:
You could also use the following free command line application to send your email.

http://www.interlog.com/~tcharron/blat194.zip

I added the required to your script. You must customize it to suit your needs.

Note that I did not review your suggested batch file.

Have fun,
Rene

@aarontomosky: I find your suggested link quite interesting.

 
@ECHO OFF

REM Working copy with good file name  - mm/dd/yyyy

echo %date:~-4,4%
echo %date:~-7,2%
echo %date:~-10,2%

set yr=%date:~-4,4%
set mo=%date:~-7,2%
set dy=date:~-10,2%
set f2=%date:~-10,2%-%date:~-7,2%-%date:~-4,4%

echo %f2%
set fn=robo-%f2%.txt

robocopy.exe f:\ x:\ *.txt /E /SEC /NP /COPYALL /Log:%fn%
copy %fn% Robo-Today.txt


:Email
REM SETTING UP EMAIL SETTINGS
	SET EmailTo=someone@somewhere.com
	SET EmailFrom=me@somewhereelse.com
	SET EmailSubject=A very important repot
	SET EmailBody=%fn%
	SET EmailServer=smtp.myispsmtpserver.com


C:\Tools\misc\blat.exe "%EmailBody%" -to "%EmailTo%" -f "%EmailFrom%" -s "%EmailSubject%" -server "%EmailServer%" -debug -timestamp -log "SendEmail.log" >NUL

Open in new window

0
 
Tony GiangrecoAuthor Commented:
This is a good concept, but I need the email to be sent from outlook through Exhcange. We have a firewall rule in place that only allows outgoing mail from Exchange.
0
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

 
Tony GiangrecoAuthor Commented:
Ok, how can this be done with VB in an automated manner so it is sent out daily to me?
0
 
Tony GiangrecoAuthor Commented:
We have Outlook 2003 connected to exchange on the server, not using Outlook Express.
0
 
ReneGeCommented:
Oups, my mistake. I'll look at it a bit later.

Cheers,
Rene
0
 
Tony GiangrecoAuthor Commented:
Sorry for the delay, I haven't had a chance to try this, but I will look into it today.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now