How to send an email using a windows batch file in XP

Posted on 2010-11-10
Last Modified: 2012-05-10
I am new to batch file and trying to do some things with it.  Can someone let me know how to send an email using Windows Batch File.  I am assuming that this can be done!

Many thanks
Question by:sweetiepie70
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 27

Accepted Solution

KenMcF earned 84 total points
ID: 34108059
When using batch files I like to use blat for sending emails.
LVL 54

Assisted Solution

by:Bill Prew
Bill Prew earned 83 total points
ID: 34108414
LVL 54

Expert Comment

by:Bill Prew
ID: 34108425
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.


Assisted Solution

escadavid earned 83 total points
ID: 34108992
Hi there

You can use a simple command line tool like CSSMTP

Here is an example to use it, in order to copy some files from a directory to another computer. Whole "REM" lines are comments.
REM  Put in the source directory
cd c:\backupdp
REM Trying to copy any files with *.bak extension
copy *.bak \\\F$\Backup
REM Validating if the copy was successfull then skip the ErrProc procedure
If %errorlevel%==0 Goto Success
REM If was not successfull then
cd C:\backupdp
REM Create a file called Error.log with a message
echo Backup of .bak files were NOT success > Error.log
REM This is the line to send the email to 2 addresses with a subject of "Copy Failed" and attaching the file Error.log
CSSMTP.exe -h192.168.10.37:25 -s"Copy Failed" -fC:\backupdp\Error.log
Goto End

cd C:\backupdp
Del *.bak
Del *.txt
echo Backup successfull> Backup.log

Echo End Process

Hope it helps.
LVL 54

Expert Comment

by:Bill Prew
ID: 34277385
On this one I think a number of viable answers to the question were posted, and should be recognized.  Perhaps just an equal split to all contributors.

LVL 70

Expert Comment

ID: 34277391
Sorry, but there are many questions posted like this, and the list of tools presented here does not add something new. Without the asker choosing any, and giving a reason why, I think retaining the question is useless.

Cleanup Volunteer
LVL 54

Expert Comment

by:Bill Prew
ID: 34277416
Okay, you moderators see the bigger picture better than I do, thanks for the feedback and your contributions to keep EE clean and robust.

LVL 96

Expert Comment

by:Lee W, MVP
ID: 34278267
> Sorry, but there are many questions posted like this, and the list of tools presented here does not add something new.
> Without the asker choosing any, and giving a reason why, I think retaining the question is useless.

I disagree.  This is the attitude I see on other sites, but EE has, since I can remember, never enforced preventing duplicate questions from different individuals.  If EE wants to, the time to do so is when the first question is asked, NOT when people have contributed their valuable time answering the questions.  Some of the experts who have provided information here may be trying to earn free memberships and it's not right to tell them you get nothing for this question because we have so many like it already, again, when this has not been done in the past.

I won't object again, but think this is an important point for every badger to remember and wanted to make sure it was seen.
LVL 54

Expert Comment

by:Bill Prew
ID: 34278564
Thanks for the support leew.


Featured Post

Don't Miss ATEN at InfoComm 2017!

Visit booth #2167 to see the  new ATEN VM3200 32 x 32 Modular Matrix Switch. Other highlights include the VE8950 4K HDMI Over IP Extender, VS1912 12-Port DP Video Wall Media Player  and VK2100 ATEN Control System. Register now with Free Pass Code ATEN288!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you try to extract and to view the contents of a Microsoft Update Standalone Package (MSU) for Windows Vista, you cannot extract the files from the MSU. Here we are going to explain how to extract those hotfix details without using any third pa…
How to record audio from input sources to your PC – connected devices, connected preamp to record vinyl discs, streaming media, that play through your audio card: Vista, Windows 7, Windows 8, Windows 8.1 and Windows 10 – both 32 bit & 64.
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question