Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- myid = os.getComputerID()
- print("SMail Server " ..myid.." now online.")
- rednet.open("right")
- while true do
- id, message = rednet.receive()
- if message == "4CTIV3" then
- rednet.broadcast("Computer " .. id .. " connected to the BBS")
- print("Computer " .. id .. " connected to the BBS via Modem.")
- end
- if message == "readmail" and fs.exists(id) then
- mail = fs.open(id, "r")
- print("Computer " .. id .. " read his Mail.")
- readmail = mail.readAll()
- rednet.broadcast(readmail)
- mail.close()
- fs.delete(id)
- end
- if message == "sendmail" then
- id1, to = rednet.receive()
- mail = fs.open(to, "w")
- mail.writeLine("From: " .. id)
- mail.writeLine("To: " .. to)
- id2, tm = rednet.receive()
- mail.write(tm)
- mail.close()
- print("Computer " .. id .. " sent Mail to " .. to)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment