Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 259
  • Last Modified:

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
0
rderidder
Asked:
rderidder
  • 10
  • 6
  • 3
  • +4
1 Solution
 
dew_associatesCommented:
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
0
 
CrazyOneCommented:
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
0
 
andydisCommented:
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?
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
rderidderAuthor Commented:
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
0
 
dew_associatesCommented:
RDR, you would probably be better off posting this in the VBS or a scripting area rather than try and batch it.
0
 
rderidderAuthor Commented:
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..

0
 
rderidderAuthor Commented:
mapisend.exe was suggested also.. Looking into that too..
0
 
CrazyOneCommented:
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.
0
 
LongbowCommented:
'--- Beginning of Sendmail.vbs ---
'This only ork with Outlook installed.
'Put all of this script in a .vbs file.
'Script wich send a file attach and copy files.
'Requirement : VbScript Engine (in MSIE5 or http://msdn.microsoft.com/scripting)
'You need to change variables in third paragraph to suit your needs.
'

Dim objOutlook
Dim objNameSpace
Dim mItem
Dim strReceipient
Dim strSubject
Dim strBodyText
Dim strMsg
Dim pAttachment
Dim strAttach
Const olMailItem = 0

'Modify the three next variables as needed and the paths in the last paragraph.
strSubject = "Enter Subject Line."
strRecipient = "xxx@yyy.com"
strBodyText = "Message text : Wow!" & VbCrLf & "This really works!" & VbCrLf

   Set objOutlook = CreateObject("Outlook.application")
   Set objNameSpace = objOutlook.GetNamespace("MAPI")
   Set mItem = objOutlook.CreateItem(olMailItem)
   
   mItem.To = strRecipient
   mItem.Subject = strSubject
   mItem.Body = strBodyText
   
   mItem.Save
   mItem.Send
   
   If strRecipient = "" Then
     Msgbox "No Recipient provided.  Mail not sent", vbInformation,"Mail Error"
   End If

   Set mItem = Nothing
   Set objNameSpace = Nothing
   set objOutlook = Nothing
'--- End of Script ---

run a command like "if exist file.iso cscript sendmail.vbs"
0
 
rderidderAuthor Commented:
Will this queue the mail if the user is not currently connected?
0
 
LongbowCommented:
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 ---
0
 
rderidderAuthor Commented:
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
0
 
LongbowCommented:
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 ?
0
 
rderidderAuthor Commented:
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
0
 
rderidderAuthor Commented:
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
0
 
darrenburkeCommented:
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?"

0
 
rderidderAuthor Commented:
Please let me know if it queues the email.
Thanks
Rich
0
 
Kyle SchroederEndpoint EngineerCommented:
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
0
 
dew_associatesCommented:
Makes sense dog!
0
 
darrenburkeCommented:
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)
0
 
rderidderAuthor Commented:
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
0
 
LongbowCommented:
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 ?
0
 
rderidderAuthor Commented:
Still havn't tested the queing thing.. But I'm pretty confident.
0
 
LongbowCommented:
Test it and create a new question about queuing the mails.
0
 
LongbowCommented:
Test it and create a new question about queuing the mails.
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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