Link to home
Start Free TrialLog in
Avatar of rderidder
rderidder

asked on

Sending mail from Command prompt

Hi,

I am sending out a CD to many users. I am creating a simple batch file which will copy the contents onto their hard drive.

I would like to include a confirmation email. This email should get sent after the copy, so that I know which users have completed the copy.
The users may not have outlook open, and they may not even be connected to the server at that time.

Is there a way I can create the email from the batch, and send it? (Note that sending it, really just puts it in the outbox, ready for the next time they connect).

Thanks for any tips,
RDR
Avatar of dew_associates
dew_associates
Flag of United States of America image

I'm a bit confused here. You say you are sending a CD to many users, therefore I presume that you are physically mailing it. Do I also presume that once they do the installation, you want the installer to notify you by email that they have completed that operation?

Dennis
Also there is a presumption here that all the users are using Outlook. What if they are using OE or Netscape or some other email client. Also are you informing the user that you are going to be doing this? If you are not informing them that you are going to be doing this then I think there is a question about ethics here and privacy issues. Quite frankly I don't think this can be accomplished with a batch file per se. To many variables involed to quarantee any degree of success. This sounds like something that would need to be ran with a script or an exe file using MAPI functions.


Hi Dennis


The Crazy One
Avatar of andydis
andydis

MAILTO:user@domain.com

usually works in a bat file
start MAILTO:user@domain.com

however if you wnat to send it then you are going to have to wrtie something a little better than a batch file...

why not have the bat file call a vbs file? with the echo command it can be done?
Avatar of rderidder

ASKER

All users are on Outlook.
All users have been notified of the process.

I have been told by someone to look at Q151670, but as yet, I don't know what topic area, and searching on that doesn't seem to work.

Dennis - you are correct

Thanks
RDR
RDR, you would probably be better off posting this in the VBS or a scripting area rather than try and batch it.
I don't mind using the MAILTO, and having the user press the send button... Have to test it out..(Does it queue the message until the user is connected, or will it error?)

Can I put the subject and body info in it at all?
I will look into MAILTO..

mapisend.exe was suggested also.. Looking into that too..
Thanks for the clarification rderidder. I agree with Dennis this would work better with a srcript overall and the VB forum may better serve you on this. I don't think a batch file would be queued but I never tried it.
ASKER CERTIFIED SOLUTION
Avatar of Longbow
Longbow

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Will this queue the mail if the user is not currently connected?
If you absolutely need a batch try this.
Body will be on only one line.
And actually i have no solution to press the Send button but in VBScript.

I will search to use mapi with VBScripts. Maybe have you posted in the VB thread...

--- beginning of batch ---
set muser=XXX
set musercc=YYY
set msubject="here my subject"
set mbody="body message"

start mailto:%muser%?cc=%musercc%&subject=%msubject%&body=%mbody%

rem to create your mailto use this URL
--- end of batch ---
It isn't much of a difference for me... Unless only one of them will queue the mail if the user is not currently connected...

RDR
It opens Outlook and send the mail immediately.
I think Outlook will open the connection ?
Sorry, i have not read all the posts.
I need to save the info in a file and check the connection is open or not.
Maybe checking some TCP/IP settings like the IP ?

Have someone an idee ?
It isn't much of a difference for me... Unless only one of them will queue the mail if the user is not currently connected...

RDR
Outlook will queue it until it can send it... Thats good enough for me. As long as it actually opens outlook, and puts the message in the outbox.

Thanks
here is a FREEWARE utility called COMMAIL that I use all the time.  It works great

http://www.xwebware.com/products/commail/


 Here are a list of valid command parameters:

  -help
  -host=<SMTP Server>
  -from=<Your Email Address>
  -to=<Receipient's Email Address>
  -bcc=<Receipient's Email Address>
  -subject=<Subject>
  -msg=<Filename>
  -text=<Text Message>
  -attach=<Filename>
  -log=<Filename>
  -config=<Filename>

 An example of a valid line would be:

 commail -host=mail.hsv.com -from=eric@hsv.com -to=everyone@world.com -msg=c:\windows\readme.txt

 NOTE: If the parameter contains spaces, then you will need to type quotes around it.
      example: -text="Hi, how are you doing?"

Please let me know if it queues the email.
Thanks
Rich
rderidder:
I think darrenburke's suggestion is a program that is self-contained and sends the mail directly, bypassing Outlook.  The message is submitted directly to the SMTP (Simple Mail Transport Protocol, email) server.  So you'd have to bundle the commmail.exe into your CD setup somewhere and call it at the end of the installation.  Sounds feasible at least...

-d
Makes sense dog!
if you try develop something that uses MAPI rather than just SMTP you need to make sure the clients have Outlook 2000 WITHOUT SP1 or SP2.  Security enhancements in Outlook will not allow the client to send messages automatically.  You will not have this problem using SMTP (and using COMMAIL)
I think I'm going witht he vbs.
I am in the midst of testing it on a client who is not connected.. But it works fine with a connected user.

As long as Outlook saves it, and retries sending it once the user connects, I'm happy.

RDR
Ok, happy if it is working.
I will add an option.
If there is no way to send then save the message to a file.
When the connection is established then send the file as message.

How it works for you ?
Wich message do you use and how ?
What are exactly the conditions ?
Still havn't tested the queing thing.. But I'm pretty confident.
Test it and create a new question about queuing the mails.
Test it and create a new question about queuing the mails.