Most users at my organization have all of the utilities to keep their computer running smoothly, but fail to use them on a regular basis if ever.
I have written a few batch files which execute all of these programs, clean this, clean that, defragment, and so on and so forth.
Each time the file runs, it records the information to a simple text file (Date, Time, Action). I want to know if there is any way to have an e-mail with that attachment sent to me at the time the process is completed. What syntax do I use to send that file? Is there a way in CMD to do this?
All users are using Outlook (2000-2003).
Software/Hardware used:
ASKED:
July 28, 2008 2:56 PM
UPDATED:
April 18, 2013 7:34 PM
Thanks Martin.
I am looking for the syntax of the batch file to write, I do not want to use a program to do this.
I have been looking through various command lines.
MAPISEND is a command line that is supposed to send an e-mail from the command prompt…but when I enter it, whether manually in CMD or automatically via batch file, I get the classic “C:\WINDOWS\system32>mapisend
‘mapisend’ is not recognized as an internal or external command,
operable program or batch file.”
Does anyone know of any other commands?
By the way…MAPISEND is not listed in Microsoft’s technet library.
Hi,
Would something like this work for you ?
Outlook.exe /c ipm.note /m youremailadress /a yourfilename.txt
Regards,
Martin.
When i use that i get an error message
The command line argument is not valid. Verify the switch you are using.
I think this is the key tho.
The previous error message i posted is when outlook is open.
When closed I get the same thing with “Cannot open Microsoft Outlook” before that.
I just thought of something I would like to add.
I am writing this batch file so that I can deploy it on multiple workstations so that without the user’s knowing, it sends a logged text file on their computer to me, so I can view it.
I’m not sure if that was understood or not. Thanks.
I’ve gotten to the point where the batch file runs a command and an new e-mail message is created. This is good progress…but i’ve scoured all over MSDN and can’t find a way to actually send it, unless its encrypted (not even sure about this).
Pointers?
Hi,
The sending option was something I thought was missing from the command line parameters, but there must be a away of doing this. Unfortunately I don’t have outlook available at the moment to try this. If you try starting outlook from a command line with /? or /help or -help does it give you any information, maybe there’s another switch or parameter that wasn’t listed on that web site?
I suppose the first time the user goes to check their mail it’ll get sent, but you probably want it sent at the time your batch file runs.
Regards,
Martin.
I will explore various command line executions to see if there is a way of doing this.
You are correct, I want to file sent immediately at the end of the batch file.
Hi,
Maybe This can help?
Regards,
Martin Gilbert.
I found this syntax to be a possibility:
C:\>mailto:<to email>?cc=<cc email>&bcc=<bcc email>&subject=HELLO%21&body=HELLO%21
but entering that gave me this:
>& was unexpected at this time.
I will check out what you suggested.
Hi,
Have you tried putting spaces between all the > and & characters ?
Regards,
Martin.
I have not tried that. I will try that.
I may just end up installing bmail or blat but i had not wanted to do this originally.
Same as before:
C:\>CC:\>mailto:<to email> ?cc=<cc email> &bcc=<bcc email> &subject=HELLO%21 &bo
dy=HELLO%21
& was unexpected at this time.
C:\>CC:\>mailto:<to email> ?cc=<cc email> &bcc=<bcc email> &subject=<HELLO%21> &
body=<HELLO%21>
& was unexpected at this time.
I have spent a good 90 minutes today trying to find the write syntax making outlook calls and switches to no avail. I think i might just default to downloading a program. I will have to deploy this in the installation package for the group of files I will be using.
Thanks again for the help.
Schmidtw,
Not that you probably can’t do it via batch. But the tool I’ve used for the last 5 years is WINBATCH. It is a utility that allows you to create programs to do this type of thing that can be compiled and deployed to your end-user PC’s so they can’t alter the code and it runs in all environments from Windows 98 to Vista. It is quick, easy to learn, has great support and a ton of samples on their web site and great user community. I’ve got several little apps similar to what you want to do. They run tasks on users pc to clear files, run apps then email me and other support staff when the task has been completed.
You can check winbatch out at http://www.winbatch.com I went for the winbatch/compiler option since I wanted to be able to send executables to various end-users without them being able to alter code.
Also use this to automate tasks on the servers under my control run other admin tasks.
Chuck
We use blat to monitor files/services and it is effective and can run in the background without user intervention. Using the Outlook command line approach may require user credentials/authentication to permit the message sending event to happen. I wish you luck but it sounds like you have already spent a lot of time going down a road that no one else seems to have been able to get to work either.
Yes, it seems after much work and time the outlook of the Outlook Command Line road is not so good.
I have taken a look at a few different tools, Blat included.
Knowing that servies and tasks and important features are running is important enough to merit installation of a small tool like Blat.
Thanks again,
-Schmidtw