marsmail-0.1

This commit is contained in:
Mario Fetka 2011-11-13 00:46:51 +01:00
commit 3cc84d97d2
12 changed files with 444 additions and 0 deletions

BIN
marsmail.exe Executable file

Binary file not shown.

174
marsmail.pas Executable file
View File

@ -0,0 +1,174 @@
program Marsmail;
uses dos;
var mailfile, numfile, outfile: text;
number, miline, moline, sl, slc: string; {mail-in, mail-out}
nfile, odir, mfile: string; {numberfile, output dir, mailfile}
numbint: longint;
o, code, mi, i,j: integer; {mailindex}
prevline, shortline,v : boolean; {v=verbose}
Function FileExists(FileName: String): Boolean;
{ Boolean function that returns True if the file exists;otherwise,
it returns False. Closes the file if it exists. }
var
F: text;
begin
{$I-}
Assign(F, FileName);
FileMode := 0; { Set file access to read only }
Reset(F);
Close(F);
{$I+}
FileExists := (IOResult = 0) and (FileName <> '');
end; { FileExists }
Begin
v:=false;
nfile:='i:\pmail\in\numfile';
mfile:='i:\pmail\in\mailfile.dos';
odir:='i:\pmail\in';
for i:=1 to paramcount do
begin
sl:=paramstr(i);
for j:=1 to length(sl) do sl[j]:=upcase(sl[j]);
if (pos('/N=',sl)=1) then nfile:=copy(sl,3,length(sl)-3);
if (pos('/O=',sl)=1) then odir:=copy(sl,3,length(sl)-3);
if (pos('/M=',sl)=1) then mfile:=copy(sl,3,length(sl)-3);
if (pos('/V',sl)=1) then v:=true;
if (pos('/?',sl)=1) or (pos('/H',sl)=1) or (pos('/HELP',sl)=1) then
begin
Writeln('Copyright 1996/9 Dud software');
Writeln;
Writeln('Purpose: Creates *.cnm files from a unix mail file for Pegasus');
Writeln('Usage: marsmail.exe [/n=x:\numb\file] [/m=y:\mail\file]');
Writeln(' [/o=z:\base\out\dir] [/v] [/?|h|help]');
Writeln('Where:');
Writeln(' /n = numberfile, /m=singlemailfile, /o=outputbasedir');
Writeln(' /v = verbose messaging mode, /?|/h|/help = this help screen');
writeln('And: numberfile contains a single 8 digit number e.g. 00000019');
writeln(' singlemailfile is the unix /var/spool/mail/userfile unix2dos');
writeln(' converted. outdir is the dir where *.cnm files should be created');
writeln(' without the trailing \');
writeln;
writeln;
writeln;
halt(2);
end;
end;
{ Open the numfile to read in a number }
if v then writeln('Opening Number file...');
if FileExists(nfile) then
Begin
{$I-}
assign (numfile,nfile);
reset(numfile);
if doserror >0 then begin writeln('Error reading '+nfile); halt(1); end;
{$I+}
if v then writeln('Reading number file...');
readln(numfile,number);
close(numfile);
end
else
Begin
assign (numfile,nfile);
{$I-}
Rewrite(numfile);
{$I+}
if doserror >0 then begin writeln('Error rewriting '+nfile); halt(1); end;
number:='00000000';
if v then writeln('Creating a new number file');
writeln(numfile,number);
Close(numfile);
end;
val(number,numbint,code);
numbint:=numbint+1;
str(numbint:8,number);
if v then writeln('Converting spaces to zeroes');
for i:=1 to length(number) do if number[i]=' ' then number[i]:='0';
{ Open the converted mailfile and start reading it }
slc:='|/-\|/-\';
sl:='|';
o:=2;
assign(mailfile,mfile);
assign(outfile,odir+'\'+number+'.cnm');
{$I-}
if v then writeln('Opening mailfile for reading...');
reset(mailfile);
{$I+}
if doserror >0 then begin writeln('Error opening '+mfile); halt(1); end;
if eof(mailfile) then
begin
close(mailfile);
halt(3);
end;
{$I-}
if v then writeln('Opening '+odir+'\'+number+'.cnm file for writing....');
rewrite(outfile);
{$I+}
if doserror >0 then begin writeln('Error rewriting '+odir+'\'+number+'.cnm'); halt(1); end;
mi:=0;
shortline:=false;
writeln('Creating mail messages from UnixMail file to Pegasus mail messages.');
write('Working \');
if v then write(' Line:');
while not eof(mailfile) do
begin
readln(mailfile,miline);
if v then write(mi,':');
prevline:=shortline;
shortline:=false;
if (length(miline)<2) then
begin
shortline:=true;
end;
mi:=mi+1;
if ( (not v) and ((mi mod 10)=0)) then
begin
write(char(8)+sl);
sl:=slc[o];
o:=o+1;
if o=9 then o:=1;
end;
if (mi>5) and (prevline=true) then begin
if (((pos('Received:',miline)=1)
or (pos('Return-Path:', miline)=1)
or (pos('From ',miline)=1)
or (pos('From:',miline)=1))
and (prevline=true)) then
begin {to flush file and start a new one}
close(outfile);
numbint:=numbint+1;
str(numbint:8,number);
for i:=1 to length(number) do if number[i]=' ' then number[i]:='0';
assign(outfile,odir+'\'+number+'.cnm');
rewrite(outfile);
if v then writeln;
if v then writeln('Finished with message no ',numbint-1,'...');
mi:=0;
end;
end;
writeln(outfile,miline);
end;
if v then writeln;
if v then writeln('Closing output files');
close(outfile);
if v then writeln('Closing mail file');
close(mailfile);
assign (numfile,nfile);
if v then writeln('Updating number file');
rewrite (numfile);
writeln(numfile,number);
close(numfile);
writeln(' ');
if v then writeln('Program finished.');
end. {of program}

11
ohmail Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
while [ true ] ;
do
for x in `cat /etc/ohmaillist`
do
/usr/sbin/ohmessage $x
sleep 1
done
sleep 5
done

24
ohmessage Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
s1="`cat /var/spool/mail/$1 | grep Subject | wc -l`"
let s2=`cat /tmp/mail/$1`
if let "$s1 > $s2"
then
if smbstatus | grep " $1 " > /dev/null
then
for machine in `smbstatus | grep " $1 " | awk ' {print $5}' | sort | uniq`
do
echo "$1 has new mail `grep From: /var/spool/mail/$1 | tail --lines=1`" | smbclient -M $machine 2>&1 > /dev/null
echo $s1 > /tmp/mail/$1
echo "`date` -- Sent notification to SMB user $1 at $machine" >> /var/log/ohmessage.log
done
elif /usr/local/bin/nwuserlist -S ohamster -U ohmessage -P sendthemall | grep -i " $1 " > /dev/null
then
/usr/local/bin/nsend -S ohamster -U ohmessage -P sendthemall $1 "New mail `grep From: /var/spool/mail/$1 | tail --lines=1`"
echo $s1 > /tmp/mail/$1
echo "`date` -- Sent notification to NetWare user $1" >> /var/log/ohmessage.log
fi
else
echo $s1 > /tmp/mail/$1
fi

18
ohpostme Executable file
View File

@ -0,0 +1,18 @@
#!/bin/bash
#This script runs through all the user dirs to collect mail that needs to be sent.
while [ true ] ;
do
cd /hamster/home
for l in `cat /etc/ohmaillist`
do
for x in `ls $l/pmail/out`
do
cat "$l/pmail/out/$x" | sed "1,4d" | /usr/sbin/sendmail -f "<$l@eng.rau.ac.za>" -t
rm "$l/pmail/out/$x"
echo "`date` -- Mail message $x send from $l mailbox" >> /var/log/ohpostme.log
done
sleep 1
done
sleep 5
done

26
ohsendnt Executable file
View File

@ -0,0 +1,26 @@
#!/bin/bash
messge=$1
machs=$2
if [ "$messge" = "" ]; then
echo "Usage: ohsendnt \"Message\" \"machine.list\"|ALL"
echo "e.g. ohsendnt \"Hello!\" \"dud.rau.ac.za\""
exit;
fi
if [ "$machs" = "ALL" ]; then
for l in `smbstatus | awk '{ print $5 }' | sed '/machine/d' | sort | uniq | sed '1 d'`
do
echo "$messge" | smbclient -M $l > /dev/nul
d=`date`
echo "Message $messge sent to NT user $l on $d" >> /var/log/ohsentnt.log
done
else
for l in $machs
do
echo "$messge" | smbclient -M $l > /dev/nul
d=`date`
echo "Message $messge sent to NT user $l on $d" >> /var/log/ohsentnt.log
done
fi

16
pmail.bat Executable file
View File

@ -0,0 +1,16 @@
@echo off
if not exist i:\pmail\nul mkdir i:\pmail > nul
if not exist i:\pmail\out\nul mkdir i:\pmail\out > nul
if not exist i:\pmail\in\nul mkdir i:\pmail\in > nul
set pmuser=%name%
:SzLoop
Echo Please wait -- converting mail from unix to dos format...
rem chksz f:\unixmail\%name% %temp%\%name%
unix2dos f:\unixmail\%name% > i:\pmail\in\mailfile.dos
rem chksz f:\unixmail\%name% %temp%\%name% -c
rem IF Errorlevel 1 goto SzLoop
copy j:\dos\net\pmail\zero.txt f:\unixmail\%name% > nul
j:\dos\net\pmail\marsmail.exe
i:
cd \pmail\in
j:\dos\net\pmail\pmail.exe -a

BIN
pmail.cfg Executable file

Binary file not shown.

175
pmdflts.ini Executable file
View File

@ -0,0 +1,175 @@
[General]
Home mailbox location = I:\PMAIL
Folder for copies to self = COPYSELF
Commenting string = ">"
Default reply-to address =
MHS mailbox name =
MHS Application directory =
MHS address =
Scan MHS application directory = N
Copy to self = P
Edit mail before forwarding = Y
Save deleted messages until exit = N
Leave read mail in newmail folder = N
Request confirmation of reading = N
[Pegasus Mail for DOS]
Folder sort order = 0
Default right margin = 74
External Editor Command =
Temporary files directory =
Reply field settings =
Trim spaces in editor = N
Print device = 0
Queue or file name =
Postscript printer = N
Lines per page = 66
Postscript font ID = 0
Swap out when calling DOS = N
Print a banner page = N
Startup directory = I:\PMAIL
Keyboard setup file =
Show address in folders = N
Suppress print dialog = N
Open new mail folder at startup = Y
Prompt for copyself folder = N
Address book sort order = 0
Require password at startup = N
Use MIME features = N
Default MIME character set = ISO-8859-1
Postscript font size = 12
Send FF to printer at end of job = N
Printer ID = 0
Paste addresses from address book = N
Wrap lines in message reader = N
Use PGP encryption routines = N
Encrypt copies-to-self of encrypted mail = N
Don't confirm message deletion = N
Enclose attachments instead of separating = N
Noticeboard sort order = 0
Lines to scan for message enclosures = 20
[Pegasus Mail for DOS - Run Info]
Program version = v3.22
Time and date run ended = Fri, 30 Aug 1996 11:10:52
Running in standalone mode? = N
Available DOS RAM after loading = 408112
Internal username =
Working home mailbox location = I:\PMAIL
New mailbox location =
SMTP gateway status = Disabled, not preferred, not 'use always'.
SMTP operating mode = Queue
SMTP queue or spool directory =
MHS status = Disabled, not preferred, not 'use always'.
MHS directory path = OHAMSTER/SYS:
MHS operating mode = SMF-70
[Pegasus Mail for Windows - built-in TCP/IP Mail]
Host where POP3 mail account is located = ohmaster.rau.ac.za
POP3 mail account (username on host) =
Password for POP3 mail account =
Delete downloaded mail from host = Y
Largest message size to retrieve = 0
Directory to place incoming POP3 mail = I:\PMAIL
Transport control word = 0
SMTP relay host for outgoing mail = ohmaster.rau.ac.za
Search mask to locate outgoing messages = I:\PMAIL\*.MSG
Alternative From: field for message =
TCP/IP timeout value (seconds) = 10
[Pegasus Mail for Windows]
Default right margin = 70
Folder sort order = 0
Temporary files directory =
Activity flags = 32
Reply field settings = 010100000
Startup directory = I:\PMAIL
Open new mail folder at startup = N
Prompt to select copy to self folder = N
Address book sort order = 0
Require password at startup = N
Use MIME features = Y
Default MIME character set = ISO-8859-1
Encrypt copies-to-self of encrypted mail = N
Don't confirm message deletion = N
Enclose attachments instead of separating = Y
Noticeboard sort order = 0
Lines to scan for message enclosures = 20
Button panel mode = 2
Button panel is closed = N
Button panel window rectangle = 0 0 0 0
New mail folder window rectangle = 5 5 504 336
Default signature for outgoing mail = 0
Request confirmation of delivery = N
Application window frame is maximized = N
Application window rectangle = 22 22 774 506
Editor window default width and depth = 0 0
Reader window default width and depth = 0 0
Font to use in message reader = Helv, 14, 0
Font to use in message editor = , 0, 0
Font to use in folder browser = Helv, 14, 0
Font to use for printing = , 0, 0
Offer advanced reply options = N
Top/bottom margin for printing = 20 1
Left/right margin for printing = 20 1
Local user list window rectangle = 0 0 0 0
Reformat hard line breaks in replies = N
Printer device name =
Printer driver name =
Printer port =
Tab width in message editor (0-disable) = 0
Logged-in user list window rectangle = 0 0 0 0
Save desktop state between sessions = N
Wrap long lines in message reader = N
Built-in POP3 transport options word = 64
Don't autoload WINSOCK.DLL if found = N
Seconds between POP3 new mail checks = 0
Seconds between regular new mail checks = 10
Secondary organization name =
Timezone for internal transport =
Refuse confirm-read requests (internal) = N
Telltale window mode = 0
Telltale window control word = 0
Location of TLC of telltale window = 0 0
DList Manager window rectangle = 0 0 0 0
Noticeboard Manager window rectangle = -4 -23 774 435
Header printing setting = 0
Extensions manager window rectangle = 0 0 0 0
WAV file for new mail sound alert =
Folder manager window rectangle = 0 0 0 0
Omit message headers when replying = N
Use custom header when replying = N
Custom header format string = On ~D at ~T, ~F wrote:
Font to use in folder manager window = , 0, 0
Quick folder definition =
Quick folder definition =
Quick folder definition =
Quick folder definition =
Quick folder definition =
Quick folder definition =
Quick folder operating flags = 0
MHS directory service window rectangle = 0 0 0 0
Use system colours = N
Display hot URLs in reader = 1
Web browser commandline =
Message reader format options = 0
[Pegasus Mail for Windows - Run Info]
Program version = v2.42a (Win16), Jul 22 1996
Language resources = Standard UK English resource set
Time and date run ended = Thu, 5 Sep 1996 11:36:49
Running in standalone mode? = N
Internal username =
Working home mailbox location = I:\PMAIL
New mailbox location = I:\PMAIL
LAN-based SMTP gateway status = Disabled, not preferred, not 'use always'.
MHS status = Disabled, not preferred, not 'use always'.
MHS directory path = \\OHAMSTER\SYS/
MHS operating mode = SMF-70
NICA module: Novell NetWare Bindery Mode
NICA module version: 1.0 release 4, Dec 6 1995
File server name: OHAMSTER
Server version: 3.11 rev 0, 90 user
Connections: Highest, 1; Current, 1
Shell/Requester version: 1.20.0

BIN
pmgate.sys Executable file

Binary file not shown.

BIN
unix2dos.exe Executable file

Binary file not shown.

0
zero.txt Executable file
View File