: This batch file allows use of mailto URL's with lynx. It uses
: SENDMAIL.EXE and MAIL.SED in the directory where the *.msg files
: reside (e.g. \spool). Substitute your real email address and name in
: the first line and your username for "username" and your real smtp
: server for "your.smtp.server" as the argument for SENDMAIL.
@echo off
gecho -E '%1 %2 %3 %4 %5 %6 %7 %8 %9' >f:\spool\args.txt
gecho  -n '@echo off\nset ADDRESS.TMP=' >f:\spool\address.bat
sed -e "s/^.*-t \(.*\) -F .*$/\1/" f:\spool\args.txt >>f:\spool\address.bat
call f:\spool\address.bat
del f:\spool\address.bat
gecho "$$ Your Name \074username@your.isp.com\076\nT %ADDRESS.TMP%" >f:\spool\m0001.msg
: This puts the FROM and TO in the envelope.
gecho  -n '@echo off\nset SENDMAIL.TMP=' >f:\spool\tempfile.bat
sed -e "s/^.*-F //" f:\spool\args.txt >>f:\spool\tempfile.bat
call f:\spool\tempfile.bat
del f:\spool\tempfile.bat
del f:\spool\args.txt
sed -n -f f:\spool\mail.sed %SENDMAIL.TMP% |tr , '\012' >>f:\spool\m0001.msg
: This puts the CC: in the envelope.
gecho >>f:\spool\m0001.msg
cat %SENDMAIL.TMP% >>f:\spool\m0001.msg
gecho >>f:\spool\m0001.msg
set SENDMAIL.TMP=
set ADDRESS.TMP=
pushdir
f:
pushdir
cd \spool
sendmail username@your.smtp.server
gecho
IF ERRORLEVEL 13 GOTO 13
IF ERRORLEVEL 12 GOTO 12
IF ERRORLEVEL 11 GOTO 11
IF ERRORLEVEL 10 GOTO 10
IF ERRORLEVEL 9 GOTO 9
IF ERRORLEVEL 8 GOTO 8
IF ERRORLEVEL 7 GOTO 7
IF ERRORLEVEL 6 GOTO 6
IF ERRORLEVEL 5 GOTO 5
IF ERRORLEVEL 4 GOTO 4
IF ERRORLEVEL 3 GOTO 3
IF ERRORLEVEL 2 GOTO 2
IF ERRORLEVEL 0 GOTO 0
:13
gecho 13 - No Server Specified in Command Line
PAUSE
GOTO end
:12
gecho 12 - Syntax Error
PAUSE
GOTO end
:11
gecho 11 - Cannot Resolve Host
PAUSE
GOTO end
:10
gecho 10 - Error Sending END-OF-MESSAGE Code
PAUSE
GOTO end
:9
gecho 9 - Error Initiating Data Transmission
PAUSE
GOTO end
:8
gecho 8 - Inadequate Receiver's Information
PAUSE
GOTO end
:7
gecho 7 - Inadequate Sender's Information
PAUSE
GOTO end
:6
gecho 6 - No "From" Field
PAUSE
GOTO end
:5
gecho 5 - No Files to Send
PAUSE
GOTO end
:4
gecho 4 - Error Negotiating
PAUSE
GOTO end
:3
gecho 3 - Cannot Connect to Server
PAUSE
GOTO end
:2
gecho 2 - Time-Out
PAUSE
GOTO end
:0
gecho 0 - Host Closed - All Ok
PAUSE
:end
popdir
popdir
