Jump to content




Sending Real Email In Computercraft


5 replies to this topic

#1 elfin8er

  • Members
  • 133 posts

Posted 08 December 2012 - 09:33 AM

Not sure if this is even possible. I wanted to send an actual email (Like to gmail or something) via computercraft. Anyone know if this is possible, and how I would go about doing it?

#2 Cranium

    Ninja Scripter

  • Moderators
  • 4,031 posts
  • LocationLincoln, Nebraska

Posted 08 December 2012 - 09:46 AM

Not that I know of. You would have to use some form of authorization, and ComputerCraft does not have anything built for that. The only thing I think you could do is use some web application that takes an http.post() command, and adds that to an email system already waiting for a message.

#3 Kolpa

  • New Members
  • 260 posts
  • LocationGermany

Posted 08 December 2012 - 10:02 AM

well google isn't supporting http only access as far as i can see so you would have to create a workaround using tomcat/python or php

#4 Sammich Lord

    IRC Addict

  • Members
  • 1,212 posts
  • LocationThe Sammich Kingdom

Posted 08 December 2012 - 11:03 AM

You will have to write a script in PHP that sends a email depending on some args, put it on a webserver, and use http.post to send it data. That is the only way I can think of.

#5 Cranium

    Ninja Scripter

  • Moderators
  • 4,031 posts
  • LocationLincoln, Nebraska

Posted 08 December 2012 - 12:25 PM

Either way you do it, you won't be able to send/receive emails without some sort of go-between; most likely something that you write yourself.

#6 elfin8er

  • Members
  • 133 posts

Posted 08 December 2012 - 02:42 PM

Mmk. I did it. For any of you guys who want to know how, here are my scripts.

ComputerCraft Script
clear
print ("Enter A Message")
local input = read()
http.post(
			    "http://example.com/page.php?message="..textutils.urlEncode(tostring(input))
                )

WebPage PHP
<?php
        $message = urldecode($_GET['message']);
        mail("EMAIL", "SUBJECT", "$message" );
?>


This will send an email with the message you put on the computercraft program. Predefine an email and subject, or adapt the program to include an input for the CC program.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users