This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
elfin8er's profile picture

Sending Real Email In Computercraft

Started by elfin8er, 08 December 2012 - 08:33 AM
elfin8er #1
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?
Cranium #2
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.
Kolpa #3
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
Sammich Lord #4
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.
Cranium #5
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.
elfin8er #6
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.