Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

send mail batch windows

  • 6 replies
  • 1 has this problem
  • 6 views
  • Last reply by Gnospen

more options

I'd like to be able to send a email from a batch file under windows. I created a bat file containing the following...

start "sendmail" /B thunderbird.exe -compose "to=xyz@abc.edu,subject=alert,body=Message_Body"

Running that opens a window with the proper to, subject, and body but I have to manually close the window. Is there some way to completely automate this process?

I'd like to be able to send a email from a batch file under windows. I created a bat file containing the following... start "sendmail" /B thunderbird.exe -compose "to=xyz@abc.edu,subject=alert,body=Message_Body" Running that opens a window with the proper to, subject, and body but I have to manually close the window. Is there some way to completely automate this process?

All Replies (6)

more options

Maybee there is a way. If not:

I needed the same function and found Blat on sourgeforge sending to a SMTP-server I named at install. My batch-code: START /wait /min BLAT %body% -to %sendto% -sender %sender% -subject %subj% -log %txt% -overwritelog

more options

I did consider blat but then you need something like stunnel for the secure socket layer and that needs .... Other folks run my stuff and I'd prefer that they not have to load a bunch of other stuff.

more options

I hope someone has an answer. I assume it's just sending ctrl+enter or "sendnow". I searched for it then and search for it now (as you must have done) In all of my hits they complained about having to press enter to send.

more options

Thanks for the help. I did stumble upon the following items

http://forums.mozillazine.org/viewtopic.php?f=39&t=540783 http://forums.mozillazine.org/viewtopic.php?t=203591 https://developer.mozilla.org/en-US/docs/Mozilla/Command_Line_Options#-options

The script in the first does seem to work BUT I have been unable to figure out how to include attachments. I know little about VB but the mixture of chr(34) (" I assume) and " seems very weird. Also the discrepancy between "mailto" and "to" between the first and third reference is troubling.

Here's what I have tried.

dim s Set s = CreateObject("WScript.Shell") s.run """thunderbird.exe""" & " -compose mailto:xxxx@xxx.edu? &subject=""send mail 3""&body=""nice body text""&attachment='file:///c:/Documents and Settings/Mike/My Documents/sendmail/vb/msg.txt'" WScript.Sleep 1000 s.SendKeys "^{ENTER}" WScript.Sleep 1000

This composes and sends an email BUT without the attachment. I have tried both single and double quotes around the file name.

more options

The mystery deepens. If I specify a non-existent file as the attachment, the email is composed but not sent automatically.

more options

Edit didn't work either way. But mine got thru even if it was a non existing file. NO response to &attachment even if its in the same directory as mailbatch

Modified by Gnospen