Discussion Locked

Emails from a batch file

0 helpful
7 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
How can I send an email from a batch file?

7 replies

by cdcents

You will need to qualify this request a little better. Do you mean send a particular email en-masse to a lot of users. You can try Groupmail for that.
If you need to send some specific info that is generated by a batch file on a server that runs IIS you can try the foll commands in a batch file. In either case will watch for updates on this thread

rem Step one is to get the mail header into the output file
echo To:receive@somewhere.com > file.txt
echo From:sender@somewhere.com>>file.txt
echo Subject:The subject here>>file.txt

rem Step two is to put the text of the email here for instance the user list
echo Users on %COMPUTERNAME% >> file.txt
net user >> file.txt

rem Step 3 transfers the output tothe mail pickup directory
move file.txt c:\inetpub\mailroot\pickup

by chris joseph

Sorry I did not specify. I am running NT and exchange 5.5. I have a UPS program that the email alert function is not working. But the execute program alert does. I just want to send a generic msg ie. "On Battery Power". to me and the Net Admin.

by mckaytech

You didn't say anything about your environment but in the Exchange environment, you can use the MAPISEND utility from the BackOffice Resource Kit.

In the Linux environment, there is a command-line option of SENDMAIL you can use.

paul

by vagab0nd

As an addition to Answer 2:

To use MAPISEND.exe you need Exchange client installed (Outlook is OK to). Switches are following:
-u - Profile name (user mailbox) of sender
-p - Login password
-i - Interactive login (prompts for profile and password)
-r - Recipient(s), multiples must be separated by ;
-c - cc: list
-s - subject
-m - contents of message (ignored if -t exists)
-t - path to text file to be used as content
-f - path to attachment

If parameter is more than one word it should be nclosed in quotes

This discussion is closed to new replies.