Hello,
Henrik bravo !
a wonderful project, a project I need my mail sender'm using 18F4620. I have W5100 or Amicus.
henrik can help me?
Hello,
Henrik bravo !
a wonderful project, a project I need my mail sender'm using 18F4620. I have W5100 or Amicus.
henrik can help me?
Hi,
Sure, no problem, give me an hour and I'll write it up for you.
Where do you want me to send it when it's finished?
No, really. I'm trying to help as much as I can but it doesn't work like that. You give some and you get some.
With that said, getting SMTP to work is not a simple task and it will not work with SSL or any other encryption. If you haven't done anything with the W5100 previosuly, like set it up to respond to a ping, serve a simple web page etc (the stuff that already IS detailed in this thread) then forget SMTP. At least untill you HAVE done the previous stuff and know a Little bit of how it works. I'm not saying that you don't, I'm just saying that if you DO then post your effort and I or someone else might be able to help you out.
/Henrik.
I agree absolutely with you the same ...
I did, the web page, UDP, TCP, with ENC28J60. but the W5100. liked very much.
I'm done with ping 5100.
I'm done with protons + 18F4620 software. I've revised your ping code for the proton.
I must take a little more now.
I bought a new module.
http://www.elektrovadi.com/w5100-ethernet-modul, PR-1389.html
then I'll continue with this module.
I wrote you about my progress from time to time. maybe I can come to the smtp portion.
You have to believe that I'm the one who worked very hard
ty for help.. If there is a flow diagram with smtp me if he could be good enough for me.
bye
![]()
Hi,
Ah, excellent work! Too bad you're using the wrong compiler. ;-)
Everything you need to know is in the RFCs covering the SMTP protocol but they can be a bit "much" from time to time. I also, strongly suggest that you do some "manual" emailing using telnet to your intended server, that way you get a feel for the protocol and what it "looks like". Anyway, here's a list from my notes
- Setup a free socket with IP adress and port (usually 25 or 2525) of remote SMTP server.
- Open the socket and wait for it to initialize.
- Issue the sockets connect command, ARP request resolves the remote MAC adress and populate the W5100 registers.
- Wait for remote server to return a response 220. If it doesn't the remote server probably isn't a SMTP server.
- Send EHLO adress.domain
- Wait for remote server to return a response 250
- Send AUTH LOGIN
- Wait for server remote server to return a response 334
- Send the username of the email account, BASE64 encoded
- Wait for server remote server to return a response 334
- Send account password, BASE64 encoded
- Wait for remote server to return a response 235 - when received the connection is authenticated.
- Send the Mail From: command
- Wait for remote server to return a response 250
- Send the Rcpt To: command
- Wait for remote server to return a response 250
- Send the DATA command
- Wait for remote server to return a response 354
- Send a <CR><LF>, a valid email header, the content of the email, followed by <CR><LF>.<CR><LF> (note the dot)
- Wait for remote server to return a response 250
- Send the QUIT command
- Wait for remote server to return a response 221 (bye bye).
- Close the connection.
A complete email including the header might look like this, note the blank lines and the dot at the end.
Date: Tue, 25 Mar 2014 19:18:00 +0200
Message-Id: <1234>
From: Your W5100
To: Someone <[email protected]>
Subject: Test
Hello,
This is a test.
.
If you don't want to use authenticated login the use the HELO command instead of EHLO.
And again, note that the above will not work with email servers requiring SSL or other encryption.
/Henrik.
hello henrik
thanks you for help and the pbp source code,
i was modifie your code for proton basic , and i was use 18F4620 , now wprking very stabile.
my web server
- ping it is ok!
- web server it is ok
- send get ang command it is ok
- response and data it is ok
but i have any problem,
it is my html code,
how to use scrip in to do code?
index:
Buffer = "<html>" : GoSub PutStringInTXBuffer
Buffer = "<body>" : GoSub PutStringInTXBuffer
Buffer = "<title>my server</title>" : GoSub PutStringInTXBuffer
Buffer = "<h3>My Mini Web Server Alive</h3>" : GoSub PutStringInTXBuffer
Buffer = "<img src=http://www.enkatechnology.com/12.jpg >" : GoSub PutStringInTXBuffer
Buffer = "<p>Thenk you Henrik Olsson 2014</p>" : GoSub PutStringInTXBuffer
Buffer = "<form name=input action=/ method=get>" : GoSub PutStringInTXBuffer
Buffer = "<input type=submit align=center name=tst1 value=3 />" : GoSub PutStringInTXBuffer
Buffer = "</form>" : GoSub PutStringInTXBuffer
Buffer = "<form name=input action=/ method=get>" : GoSub PutStringInTXBuffer
Buffer = "<input type=submit align=center name=tst2 value=5 />" : GoSub PutStringInTXBuffer
Buffer = "</form>" : GoSub PutStringInTXBuffer
Buffer = "<a href=http://www.google.com>Go To Google</a>" : GoSub PutStringInTXBuffer
'Buffer = "<p> toplam request = " + Str$(Dec RequestCount) + "</p>" : GoSub PutStringInTXBuffer
Buffer ="<p>AN2 Data= </p>" : GoSub PutStringInTXBuffer
Buffer ="<script src=/s></script>" : GoSub PutStringInTXBuffer
Buffer ="<p><script>document.write(AN2)</script></p>" : GoSub PutStringInTXBuffer
Buffer = "</body></html>" : GoSub PutStringInTXBuffer
Return
i wat to use <script src=/s></script> and turn the back "<p><script>document.write(AN2)</script></p>" AN2 = 27 for exp. what you thing about?
i was receive "s" and portc.2 led is blinking but, i dont send the AN2 data to back.
my data receive code,
data_kontrol:
'----------------------------------
If Buffer[11] = "3" Then
PORTC.2 = 1'led aç
'END
EndIf
'----------------------------------
If Buffer[11] = "5" Then
PORTC.2 = 0'led kapat
'END
EndIf
'----------------------------------
If Buffer[5] = "s" Then
PORTC.2 =1
DelayMS 500
PORTC.2 =0
EndIf
Return
Last edited by tayfun; - 27th April 2014 at 17:26.
Hi,
Nice work! I'm glad the code is getting some use!
I know very little about HTML and even less about JAVA Script (which I suspect is what Document.Write() is?
However, doing document.write(AN2) where I'm guessing AN2 is a variable in you PBP (Proton) program probably isn't working the way you expect. For it to work the way you've coded it the PutStringInTxBuffer routine would need to be able to decode and understand Java Script, find AN2 and put its content, as a string into the buffer - that's obviously NOT how it works or is intended to work.
Again, I'm very green on this HTML and JAVA stuff so I may be wrong but that's how I think it works.
In PBP, to load a "value" from a variable into an array as a string you could use ArrayWrite, I'm not sure how to do that in Proton but I'm sure there's some ToStr or whatever.
Does that make sense?
/Henrik.
it is ok, is ok! work fine...
i will new stage , w5100 use with sd card, and screen any picture or complicate html pages. ty .. bye.
this is code,
'------------------------------------------------------------------------------------------------------------------------
send_back_result:
RequestCount = RequestCount + 1
GoSub GetFreeTXSize
TotalCount = 0
Buffer = "HTTP/1.1 200 OK "+13+10+0
GoSub PutStringInTXBuffer
Buffer = "Content-Type:text/html"+13+10+13+10+0
GoSub PutStringInTXBuffer
'---------server side------------------------------------client side----------------------------------------------------
If Buffer[5] = "s" Then '<--------------------- send me "s" block <script src=s></script>"
Buffer = "var AN2=" ' <------------send me AN2 variable <script>document.write(AN2)</script
GoSub PutStringInTXBuffer
Buffer = "1977" '-------------------> put string "1977" or any string variable
GoSub PutStringInTXBuffer
Buffer = ";"
GoSub PutStringInTXBuffer' -------------------> and put end of the string.
EndIf
'--------------------------------------- end of the cominicate
WizPtr = WizPtr + TotalCount ' load others... end.
WizAdress = W5100_S0_TX_WR0 : WizData = WizPtr.HighByte : GoSub Write_W5100
WizAdress = W5100_S0_TX_WR1 : WizData = WizPtr.LowByte : GoSub Write_W5100
' Issue a SEND command.
WizAdress = W5100_S0_CR : WizData = W5100_Sn_SEND : GoSub Write_W5100
WaitForCompletion2:
GoSub Read_W5100
If WizData <> 0 Then GoTo WaitForCompletion2
' Then disconnect from the client.
WizAdress = W5100_S0_CR : WizData = W5100_Sn_DISCON : GoSub Write_W5100
' And close the socket. We'll reopen the socket again in the main routine.
WizAdress = W5100_S0_CR : WizData = W5100_Sn_CLOSE : GoSub Write_W5100
GetRequest = 0
Return
Bookmarks