Batch email

Clarion Cmd5 in dash cd/mp3 player
January 23, 2010 at 08:02:52
Specs: Windows XP, 128
How in batch, find all files whith extension doc, put to archive and send to email, using only command.com not external programms?

See More: Batch email

Report •

#1
January 23, 2010 at 08:21:48
AFAIK there is no command line mailer in XP.


=====================================
Helping others achieve escape felicity

M2


Report •

#2
January 23, 2010 at 10:04:21
Use the power of blat with stunnel. Blat is a command line emailer. You just drop blat in system32 folder and go install Stunnel (for ssl that gmail requires). Then.. run the command line option for installing gmails smtp server and create a batch file with the blat options predefined.

Then.. you just pull up a command line prompt and type something like: note "send this text to my email" where note is the name of your batch file (note.bat)


Report •

#3
January 23, 2010 at 11:06:01
> How in batch, find all files whith extension doc, put
> to archive and send to email, using only command.com
> not external programms?
>

The mailing is not standard in XP, and I guess "archiving" may also be difficult. What do you mean by that, combining files to 1 file (like CD images, or like Zipping can do), or just Zipping ?


Report •

Related Solutions

#4
January 23, 2010 at 11:44:40
VBScript can do it though CDO.Message. I don't have time now, but I'll try to find my old VBS email example.

Report •

#5
January 23, 2010 at 20:50:12
yy4u2rel82,

Will blat & stunnel work on non-gmail SMTP?


=====================================
Helping others achieve escape felicity

M2


Report •

#6
January 23, 2010 at 21:45:13
Sure it will. I'm just suggesting gmail for your smtp server. After it's setup, you can send the actual emails anywhere you want. But... if you're already using smtp for email (Outlook or something similar), then you could just use those settings. Otherwise, you have to have an smtp program and most cost money (like QK Server). Gmail smtp is free.. so long as you have an internet connection, it works.
I have a little tut with gmail here: http://www.jeffkastner.com/2010/01/...

You'd have to add a few options to the batch file to do what you're doing.. but all very doable.


Report •

#7
January 24, 2010 at 14:46:48
Alright, I found my VBS email example. You'll have to fill out the relevant values yourself.

Also, you'll need a third party application to compress the files. I recommend 7-Zip, because it's free and command-line based. I think one of the Windows zipping applications has scriptable ActiveX/COM components, but I don't have them, and I don't know if you have them.

Also, some versions of Office interfere with the native CDO.Message. If that's the case, I can show you how to wrap it up in a .WSH file to use the "correct" CDO.Message, but then you'd have to explicitly call wscript/cscript to run the script.

Const attachName = "something.doc"
      timeout    = 15 / (24 * 60) '15 minutes
Const emailTo    = "recipient@something.com"
Const emailFrom  = "you@your.email.com"
Const emailSbjct = "Some subject"
Const SMTPServer = "smtp.your.email.com"
Const SMTPPort   = 25
Const emailUsr   = "you@your.email.com"
Const emailPsswd = "YourPassword"
Const emailSSL   = False
      emailMsg   = "Some generic message, like 'ur filez, lol'"


Const cfg = "http://schemas.microsoft.com/cdo/configuration/"
With CreateObject("CDO.Message")
  .From                                  = emailFrom
  .To                                    = emailTo
  .Subject                               = emailSbjct
  .TextBody                              = emailMsg
  .AddAttachment                           attachName
  With .Configuration.Fields
    .Item(cfg & "sendusing")             = 2
    .Item(cfg & "smtpserver")            = SMTPServer
    .Item(cfg & "smtpserverport")        = SMTPPort
    .Item(cfg & "smtpconnectiontimeout") = 60
    .Item(cfg & "smtpauthenticate")      = 1
    .Item(cfg & "smtpusessl")            = emailSSL
    .Item(cfg & "sendusername")          = emailUsr
    .Item(cfg & "sendpassword")          = emailPsswd
    .Update
  End With
  .Send
End With
WScript.Echo "Done"


Report •

Ask Question