Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 How Do I Email .txt Files?
Index -> Programming, Turing -> Turing Help
Goto page 1, 2, 3, 4, 5  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Guest




PostPosted: Sat May 20, 2006 2:05 pm   Post subject: How Do I Email .txt Files?

I was wondering how would I be able to email information using Turing. Here is my code:


var file : int
var ch : char
loop
if hasch then
ch := getchar
put ch ..
open : file, "typed_stuff.txt", put, mod, seek
seek : file, *
put : file, ch ..
close : file
end if
end loop


I want to email the typed_stuff.txt to my email.
Sponsor
Sponsor
Sponsor
sponsor
Cervantes




PostPosted: Sat May 20, 2006 2:11 pm   Post subject: (No subject)

I'm pretty sure you'll have to know the SMTP protocol. Check out Wikipedia's article on SMTP.
Guest




PostPosted: Sat May 20, 2006 2:13 pm   Post subject: Errm

Could you translate that into a block of Turing code and display it here please =) I'll love you so much if you do.
[Gandalf]




PostPosted: Sat May 20, 2006 7:23 pm   Post subject: (No subject)

No, that would be doing the work for you. You're going to have to learn it yourself, though I'm sure you'll be able to get help from various people. It won't be too difficult using Turing's Net module.
Guest




PostPosted: Tue May 23, 2006 10:01 am   Post subject: (No subject)

I tried again and again and I still don't understand it! Grrrraaawwwwrrrrrr!
Please help =...( *sniffs*

PS (I always click new topic when post reply!! Maybe switch positions of the two)
Andy




PostPosted: Tue May 23, 2006 11:01 am   Post subject: (No subject)

or learn to read before you click? oh wait, you just asked us to do your work for you.. hmm maybe you didnt read the site policy before clicking agree
Guest




PostPosted: Tue May 23, 2006 2:37 pm   Post subject: (No subject)

Im not asking for you to do it for me . I said "please help". I researched and read for like half an hour on all this emailing stuff that didn't help me. I can open a new connection, but not with gmail or hotmail! It gives me an error when I read the page. I didn't think it would be this hard. Is there like a command like, "Net.SendData("file.txt") to Server(gmail.com) @ email address (102.15.66.104) or something!
Cervantes




PostPosted: Tue May 23, 2006 3:20 pm   Post subject: (No subject)

Just look at the Turing Help file under 'Net'.

Turing Reference wrote:

WaitForConnection Waits until a client connects to a specified port.
OpenConnection Opens a connection to a specified machine.
OpenURLConnection Opens a connection to a file specified by a URL.
CloseConnection Closes a specified connection.
BytesAvailable Returns the number of bytes available to be read from a net stream.
CharAvailable Returns true if there is a character available to be read from a net stream.
LineAvailable Returns true if there is a line of text available to be read from a net stream.
TokenAvailable Returns true if there is a token available to be read from a net stream.
HostAddressFromName Returns a host's address given its host name.
HostNameFromAddress Returns a host's name given its address.
LocalAddress Returns the host name of the local machine.
LocalName Returns the TCP/IP address of the local machine.

None of those look like a Net.SendData or Net.SendFile.
So, no.

Half an hour isn't very long. You should do some more research. We've pointed you in the right direction; you've got to take a step for yourself.
Sponsor
Sponsor
Sponsor
sponsor
[Gandalf]




PostPosted: Thu May 25, 2006 9:35 pm   Post subject: (No subject)

Out of curiosity, I implemented SMTP in Turing, so now you definately know it's possible. Wink As long as you read up on what to do and know how to send data (not files) using the Net module it's really easy, though different servers handle things a bit differently so you might have to do some modifying.

Anyway, what I wanted to point out is that you won't be connecting to gmail.com. You will find all the info/links you need on the wikipedia article Cervantes pointed out, including server and port.

Finally, if you don't already, you should know how to use file I/O before using it on a Net stream.
Guest




PostPosted: Thu May 25, 2006 9:50 pm   Post subject: (No subject)

So what could I send data to? If I can't send to gmail, what about hotmail? Or what about Thunderbird or Outlook Express?

I'm kinda giving up right now on emailing through Turing because the way I learn is by watching others do it. I tired on my own and my teacher can't help me because he never uses Net. All I need is some small sample code to start off with that I can build on or something. I can do Net.OpenCOnnection, Net.WaitForConnection, and some other things when my friend is running it too, like Net.BytesAvailiable etc. But none of that works when I try to connect to a website.
[Gandalf]




PostPosted: Thu May 25, 2006 10:54 pm   Post subject: (No subject)

vahnx wrote:
So what could I send data to? If I can't send to gmail, what about hotmail? Or what about Thunderbird or Outlook Express?

Like I said, read the wikipedia article Cervantes linked to, you'll find the information there. You can still send emails to gmail, what I was saying is that you don't connect to gmail.com.

I'll try helping you out more if you can tell me what port and server to connect to first (for whatever SMTP server you want).
Guest




PostPosted: Sat Jun 03, 2006 1:24 pm   Post subject: (No subject)

Ok I just re-read that article for like the fourth time and don't like understand a word of it. Maybe I have ADD or something.

Quote:

S: 220 www.example.com ESMTP Postfix
C: HELO mydomain.com
S: 250 Hello mydomain.com
C: MAIL FROM:<sender@mydomain.com>
S: 250 Ok
C: RCPT TO:<friend@example.com>
S: 250 Ok
C: DATA
S: 354 End data with <CR><LF>.<CR><LF>
C: Subject: test message
C: From: sender@mydomain.com
C: To: friend@example.com
C:
C: Hello,
C: This is a test.
C: Goodbye.
C: .
S: 250 Ok: queued as 12345
C: QUIT
S: 221 Bye


What does the above mean?
Cervantes




PostPosted: Sat Jun 03, 2006 2:56 pm   Post subject: (No subject)

Please don't post 3 times in 2 minutes when it could all be in the one post. I've cleaned that up.

That would be the dialogue between server (S) and client (C).

To send an email with Turing, you'd have to open a connection to the SMTP server and follow that SMTP protocol. Try to mimick that dialogue that is given.
Guest




PostPosted: Sun Jun 04, 2006 1:22 am   Post subject: (No subject)

Well the edit button was disabled in the Turing Help section because of people getting the help they needed then editing their posts to make them not look as stupid, or something of that regards. And I didn't feel like copying, deleting, then re-posting.

And when I posted multiple times within 3 minutes, I thought of something more to add on to be more specific Very Happy
Guest




PostPosted: Sun Jun 04, 2006 1:34 am   Post subject: (No subject)

Cervantes wrote:
Please don't post 3 times in 2 minutes when it could all be in the one post. I've cleaned that up.

That would be the dialogue between server (S) and client (C).

To send an email with Turing, you'd have to open a connection to the SMTP server and follow that SMTP protocol. Try to mimick that dialogue that is given.


To mimic that dialogue using Turing, I'll try my best here:

code:

var stream := Net.OpenConnection ("www.gmail.com", 25)
put : stream, "Hello www.gmail.com"


Am I on the right track so far? And do I have to learn Net.TokenAvaliable or something? Turing talks nothing about SMTP Protocol and I don't understand how to interpret it to Turing.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 5  [ 64 Posts ]
Goto page 1, 2, 3, 4, 5  Next
Jump to:   


Style:  
Search: