LDShadowLord

SMail Server

Oct 10th, 2012
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. myid = os.getComputerID()
  2. print("SMail Server " ..myid.." now online.")
  3. rednet.open("right")
  4. while true do
  5. id, message = rednet.receive()
  6. if message == "4CTIV3" then
  7. rednet.broadcast("Computer " .. id .. " connected to the BBS")
  8. print("Computer " .. id .. " connected to the BBS via Modem.")
  9. end
  10. if message == "readmail" and fs.exists(id) then
  11. mail = fs.open(id, "r")
  12. print("Computer " .. id .. " read his Mail.")
  13. readmail = mail.readAll()
  14. rednet.broadcast(readmail)
  15. mail.close()
  16. fs.delete(id)
  17. end
  18. if message == "sendmail" then
  19. id1, to = rednet.receive()
  20. mail = fs.open(to, "w")
  21. mail.writeLine("From: " .. id)
  22. mail.writeLine("To: " .. to)
  23. id2, tm = rednet.receive()
  24. mail.write(tm)
  25. mail.close()
  26. print("Computer " .. id .. " sent Mail to " .. to)
  27. end
  28. end
Advertisement
Add Comment
Please, Sign In to add comment