@echo off
goto start
rem **************************************************************************
rem BareBones DOS email system. (v2.3). JDC 1999.
rem
rem You are free to use this system, providing that you accept that: there
rem is no warranty; you have no right support; and you use it at entirely
rem your own risk. Contact jchap@globalnet.co.uk for more information/help.
:go
rem **************************************************************************
rem *Enter your settings here:*****See BAREBONE.TXT for help.*****************
rem
set Telephone=
set Username=
set Password=
set COMport=
set Nameserver=
set POP3address=
set POP3username=
set POP3password=
set SMTPaddress=
set EMAILaddress=
rem
rem **************************************************************************
rem *******Advanced Settings**************************************************
set Dial=T
set Modemstring=&F&C1&D2
set COMadvanced=c
set Mailoutput=nul
set PAP=0
set Wait=40
rem **************************************************************************
rem **Dialing script**********************************************************
rem
set Receive1=ogin:
set Send1=%username%\r
set Receive2=assword:
set Send2=%password%\r
set Receive3=
set Send3=
set Receive4=
set Send4=
rem **************************************************************************
rem **Address Book************************************************************
rem
set nick1=barebones
set addr1=barebones@jchap.globalnet.co.uk
set real1=Barebones Author
set nick2=
set addr2=
set real2=
set nick3=
set addr3=
set real3=
set nick4=
set addr4=
set real4=
set nick5=
set addr5=
set real5=
rem **************************************************************************
rem **************************************************************************
rem DO NOT CHANGE THE FOLLOWING LINES UNLESS YOU KNOW WHAT YOU ARE DOING!
rem **************************************************************************
rem [Check all user settings are all filled in...]
set Dialscript=standard
set bb=2.3
set bbmode=1
if exist bbconfig.bat echo Loading external config settings file: BBCONFIG.BAT
if exist bbconfig.bat call bbconfig.bat
echo Checking system settings.
if "%telephone%"=="" goto err0
if "%username%"=="" goto err1
if "%password%"=="" goto err2
if "%comport%"=="" goto err3
if "%nameserver%"=="" goto err4
if "%pop3address%"=="" goto err5
if "%pop3username%"=="" goto err6
if "%pop3password%"=="" goto err7
if "%smtpaddress%"=="" goto err8
if "%Dialscript%"=="" goto err9
if "%bb%"=="" goto err9
if "%mailoutput%"=="" goto err9
if "%comadvanced%"=="" goto err9
if "%dial%"=="" goto err9
if "%Pap%"=="" goto err9
if "%Wait%"=="" goto err9
if "%emailaddress%"=="" goto err10
goto setok
:err0
echo The telephone number to dial is not set.
goto err
:err1
echo User name is not set. Ask your ISP if you are not sure what this should be.
goto err
:err2
echo Password is not set. Ask your ISP if you are not sure.
goto err
:err3
echo You have not set your COM port value.
goto err
:err4
echo You have not set a DNS (nameserver). Find this from your ISP.
goto err
:err5
echo You have not set a POP3 address to collect mail from.
goto err
:err6
echo You have not set a POP3 user name, (try your login user name if unsure).
goto err
:err7
echo You have not set a POP3 password, (try your login password if unsure).
goto err
:err8
echo You have not setup a SMTP address to send mail with.
:err9
echo One of your advanced settings is missing.
goto err
:err10
echo You have not set your name and email address.
echo eg: EMAILaddress=James Chapman
goto err
:err
echo Your settings are not all filled in, please edit EMAIL.BAT
echo.
goto thend
:setok
rem Check for create new msg option
if "%2"=="/N" goto msg
if "%2"=="/n" goto msg
if "%2"=="to" goto msg
if "%2"=="TO" goto msg
if "%2"=="tO" goto msg
if "%2"=="To" goto msg
if "%2"=="/C" goto cfg
if "%2"=="/c" goto cfg
if "%2"=="/r" goto premsg
if "%2"=="/R" goto premsg
if "%2"=="/g" goto lget
if "%2"=="/G" goto lget
if "%2"=="/s" goto lsend
if "%2"=="/S" goto lsend
if "%2"=="/l" goto cont
if "%2"=="/L" goto cont
if "%2"=="" goto cont
if "%2"==" " goto cont
echo Unrecognised command: "%2". Type Email /? for help.
goto thend
:cont
rem [Delete extra files?]
:delchk
echo Updating configuration...
if exist barebone.exe goto delf
goto skdel
:delf
echo Removing unused system files.
del barebone.exe
if exist barebone.txt del barebone.txt
if exist read.me del read.me
if exist pktstat.com del pktstat.com
if exist inst.exe del inst.exe
if exist termin.com del termin.com
if exist smtpop.txt del smtpop.txt
:skdel
rem [Make config.ppp file if necessary...]
rem if exist config.ppp goto skcfg
echo Creating PPP configuration file: CONFIG.PPP
echo ppp trace 40 >config.ppp
if "%PAP%"=="1" echo ppp pap user %Username% %Password% >>config.ppp
echo ppp quick >>config.ppp
echo ppp lcp open >>config.ppp
:skcfg
rem [Make dial.ppp file if necessary...]
if "%Dialscript%"=="standard" goto dodial
goto skdial
:dodial
rem if exist dial.ppp goto skdial
echo Creating login script file: DIAL.PPP
echo send "AT%modemstring%D%dial%%telephone%\r" >dial.ppp
if "%receive1%"=="" echo recv %Wait%000 >>dial.ppp
if "%receive1%"=="" goto skdial
echo recv %Wait%000 "%receive1%" >>dial.ppp
if "%send1%"=="" goto skdial
echo send "%send1%" >>dial.ppp
if "%receive2%"=="" goto skdial
echo recv %Wait%000 "%receive2%" >>dial.ppp
if "%send2%"=="" goto skdial
echo send "%send2%" >>dial.ppp
if "%receive3%"=="" goto skdial
echo recv %Wait%000 "%receive3%" >>dial.ppp
if "%send3%"=="" goto skdial
echo send "%send3%" >>dial.ppp
if "%receive4%"=="" echo recv %Wait%000 "%receive4%" >>dial.ppp
if "%send4%"=="" goto skdial
echo send "%send4%" >>dial.ppp
:skdial
rem [remove last login.ppp]
echo BareBones DOS email system. (v2.3). JDC 1999. >login.ppp
echo.>login.ppp
rem [Dial the Internet... and make network settings file, WATTCP.CFG]
rem cls
echo Connecting... (please wait).
ppp /%comadvanced% %comport% /d script >>login.ppp
echo Updating TCP settings: WATTCP.CFG
barebone login.ppp >wattcp.cfg
if errorlevel==1 goto logf
echo Connected successfully.
goto logok
:logf
echo Barebones failed to log on. (See LOGIN.PPP for connection details/help).
echo. >>login.ppp
echo If the modem does not dial, check the "COMport" setting in EMAIL.BAT >>login.ppp
echo If you do not know which COM port your modem is on, first try values 1-4, >>login.ppp
echo then check your modem manual or use a modem detection program such as >>login.ppp
echo Fmodem. >>login.ppp
echo. >>login.ppp
echo If you can't log on to your ISP, check LOGIN.PPP and see where the >>login.ppp
echo process is failing. You may need to change the default login script,>>login.ppp
echo DIAL.PPP which is created by EMAIL.BAT>>login.ppp
echo. >>login.ppp
echo If you can't send/get email, check your Nameserver and other WATTCP.CFG >>login.ppp
echo settings. >>login.ppp
echo. >>login.ppp
echo You can contact the author at jchap@globalnet.co.uk >>login.ppp
goto thend
:logok
echo nameserver=%nameserver% >> wattcp.cfg
if "%2"=="/l" goto nomail
if "%2"=="/L" nomail
rem [Send mail, (if different address from the collection mailserver).]
:send
if exist *.msg goto send2
echo No mail to send.
goto skms
:send2
rem if "%pop3address%"=="%smtpaddress%" echo Collecting/Sending mail...
rem if "%pop3address%"=="%smtpaddress%" goto skcm
echo Sending mail...
:skcm
smtpop %pop3username%@%smtpaddress% %pop3password% >> %Mailoutput%
if exist *.msg echo Mail not sent.
if exist *.msg goto skms
echo Mail sent.
:skms
if "%bbmode%"=="l" goto thend
rem [Get email...]
:get
echo Collecting mail...
smtpop %pop3username%@%pop3address% %pop3password% >> %Mailoutput%
if exist *.cnm echo You have new mail!
if exist *.cnm goto sknm
echo No mail found.
:sknm
if "%bbmode%"=="l" goto thend
goto hang
:lsend
set bbmode=l
goto send
:lget
set bbmode=l
goto get
rem [Hang up.]
:hang
echo Hanging up.
barebone /h
if exist wattcp.cfg del wattcp.cfg
if exist dial.ppp del dial.ppp
if exist config.ppp del config.ppp
if exist login.ppp del login.ppp
goto mailer
:hang2
echo BareBones DOS email system. (v2.3). JDC 1999.
echo Trying to hang up...
barebone /h
if exist wattcp.cfg del wattcp.cfg
if exist dial.ppp del dial.ppp
if exist config.ppp del config.ppp
if exist login.ppp del login.ppp
goto thend
rem [Check to see if user wants to skip login]
echo off
:start
if "%1"=="setup" goto setup
if "%1"=="/?" goto help
if "%1"=="/h" goto hang2
if "%1"=="/H" goto hang2
command /e:7192 /c email.bat setup %1 %2 %3
goto thend
:setup
echo BareBones DOS email system. (v2.3). JDC 1999.
goto go
:help
echo.
echo BareBones DOS email system JDC 1999.
echo.
echo A Simple email system for DOS based machines based on:
echo Etherppp by Merit Software Inc, SMTPOP by Alfredo Cole,
echo and BAREBONE by James David Chapman, (jchap@globalnet.co.uk).
echo.
echo Email - Connect, collect and send email, then hang up/load mailer.
echo Email /L - Just connect to the internet and quit to DOS.
echo Email /G - If connected, collect mail.
echo Email /S - If connected, send mail.
echo Email /H - Hang up a connection.
echo Email /P - Setup config files for Pegasus Mail
echo Email /C - Write external config file.
echo Email /R - Create an email settings report for Barebones author.
echo Email /N [destination email address]
echo - Create a new email template, NEW.MSG ready for editing.
echo.
echo You are free to use this system, providing you accept that there is
echo no warranty, no support and that you use it at entirely your own risk.
echo.
goto thend
barebone /h
goto thend
rem If you want to automatically start up your email program list it here:
:mailer
if exist dosmail.com dosmail /e
if exist pmail.exe pmail /u %username%
if exist mview.com mview
goto thend
:nomail
echo Type "email /h" to hang up connection.
goto thend
:cfg
echo Making external config file.
echo Writing file as: BAREBONE.CFG
echo Barebone Settings: >barebone.cfg
echo Telephone=%Telephone% >>barebone.cfg
echo Username=%Username% >>barebone.cfg
echo COMport=%COMport% >>barebone.cfg
echo Nameserver=%Nameserver% >>barebone.cfg
echo POP3address=%POP3address% >>barebone.cfg
echo POP3username=%POP3username% >>barebone.cfg
echo SMTPaddress=%SMTPaddress% >>barebone.cfg
echo EMAILaddress=%EMAILaddress% >>barebone.cfg
echo. >>barebone.cfg
echo Advanced settings.>>barebone.cfg
echo Dial=%Dial% >>barebone.cfg
echo Modemstring=%Modemstring% >>barebone.cfg
echo COMadvanced=%COMadvanced% >>barebone.cfg
echo Mailoutput=%Mailoutput% >>barebone.cfg
echo PAP=%PAP% >>barebone.cfg
echo Wait=%Wait% >>barebone.cfg
echo. >>barebone.cfg
echo Dial script >>barebone.cfg
echo Receive1=%Receive1% >>barebone.cfg
echo Send1=%Send1% >>barebone.cfg
echo Receive2=%Receive2% >>barebone.cfg
echo Send2=%Send2% >>barebone.cfg
echo Receive3=%Receive3% >>barebone.cfg
echo Send3=%Send3% >>barebone.cfg
echo Receive4=%Receive4% >>barebone.cfg
echo Send4=%Send4% >>barebone.cfg
echo.>>barebone.cfg
echo Extra settings. >>barebone.cfg
echo Dialscript=%Dialscript% >>barebone.cfg
echo bb=%bb% >>barebone.cfg
echo bbmode=%bbmode% >>barebone.cfg
echo. >>barebone.cfg
if "%bbmode%"=="2" goto cfg2
goto thend
:cfg2
echo Creating system settings email: REPORT.MSG
copy new.msg + barebone.cfg report.msg >nul
del new.msg >nul
goto thend
:premsg
set bbmode=2
set dest=barebones@jchap@globalnet.co.uk
set desr=Barebones Author
if exist new.msg echo NEW.MSG already exists, please rename or delete it and try again.
if exist new.msg goto thend
goto cm
:msg
rem Check new.msg does not already exist in directory
if not exist new.msg goto msgm
if exist new.msg echo NEW.MSG already exists, attempting to rename it...
if not exist new1.msg ren new.msg new1.msg >nul
if not exist new.msg goto msgm
if not exist new2.msg ren new.msg new2.msg >nul
if not exist new.msg goto msgm
if not exist new3.msg ren new.msg new3.msg >nul
if not exist new.msg goto msgm
if not exist new4.msg ren new.msg new4.msg >nul
if not exist new.msg goto msgm
if not exist new5.msg ren new.msg new5.msg >nul
if not exist new.msg goto msgm
echo NEW.MSG already exists, rename or delete it and try again.
goto thend
:msgm
rem Check addressbook
set dest=%3
set desr=
if "%nick1%"=="%3" set dest=%addr1%
if "%nick2%"=="%3" set dest=%addr2%
if "%nick3%"=="%3" set dest=%addr3%
if "%nick4%"=="%3" set dest=%addr4%
if "%nick5%"=="%3" set dest=%addr5%
if "%nick1%"=="%3" set desr=%real1%
if "%nick2%"=="%3" set desr=%real2%
if "%nick3%"=="%3" set desr=%real3%
if "%nick4%"=="%3" set desr=%real4%
if "%nick5%"=="%3" set desr=%real5%
rem Create the msg file
:cm
echo Making email template.
echo $$ >new.msg
echo T %dest% >>new.msg
echo.>>new.msg
echo From: %emailaddress% >>new.msg
if "%desr%"=="" echo To: %dest%>>new.msg
if "%desr%"=="" goto :sk5
echo To: %desr% (%dest%)>>new.msg
:sk5
barebone /d >>new.msg
echo Reply-To: %emailaddress% >>new.msg
echo X-Mailer: Barebones DOS email system. >>new.msg
echo Subject: >>new.msg
echo.>>new.msg
echo [Insert message here] >>new.msg
echo.>>new.msg
echo.>>new.msg
echo NEW.MSG created.
if "%bbmode%"=="2" goto cfg
if exist edit.exe edit new.msg
if exist edit.exe goto thend
if exist edit.com edit new.msg
goto thend
rem [Do not place any lines after this label, they will be run twice].
:thend
|