Link to home
Start Free TrialLog in
Avatar of dickchan
dickchan

asked on

send email by batch file

I want to send a email by using a batch file.
But when i test, the script stop after the telnet command.
Any idea how can i use SMTP command in a batch file? Thank you.
Avatar of farazhkhan
farazhkhan
Flag of Pakistan image

Hi,

Check this: http://www.robvanderwoude.com/email.php

Regards,
Faraz H. Khan
Hi,

And this one http://www.watchdirectory.net/wdhelp/plugins/wdopAutoRunBatEmail.html is more simple and explanatory.

Regards,
Faraz H. Khan
ASKER CERTIFIED SOLUTION
Avatar of Seth_McCauley
Seth_McCauley
Flag of United States of America image

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
Not sure what you are using at the moment, possibly trying to pipe text into a telnet command?  Best bet is to use something like BLAT.exe IMO to do the hard(er) work for you:  Below is a ample script I use for instance:

http://sourceforge.net/projects/blat/files/
REM * Uses blat.exe and emailbody.txt as body of message:
REM * Creates a log file in blatlog.txt
 
set logfile=blatlog.txt
 
set subject="SubjectLine"
set toaddress=youremail@address.com
set attach=C:\somefile\to\atatch.txt
set body=emailbody.txt
 
if not exist blatinstalled.txt (
   set smtpserver=123.45.67.89
   set fromaddress=fromaddress@yourdomain.com
   blat -install %smtpserver% %fromaddress%
   echo %date% %time% > blatinstalled.txt
)
 
echo Sending files....
echo %date% - %time% > %logfile%
blat emailbody.txt -subject %subject% -to %toaddress% -hostname %computername% -log %logfile% -attach %attach%
echo Send complete.

Open in new window

Ok, clearly I was a few minutes slow there de-personalising the script to attach...
Happens to me all the time :D
Avatar of palinitr
palinitr

Take a look at http://caspian.dotconf.net/menu/Software/SendEmail, we use this and never had any problems