As the title says... Chat on...

User avatar
By oskar
#8208 It is defiantly a heap issue, works today with latest firmware.
Tried to pass the commands as an array which made it run out of heap, also adding checks on all ifs or even putting the sends in a separate function makes it run out of heap and restart the module.

So a a quick and dirty way to send mail through gmail smtp. Do a node.restart() before the dofile since you need as much RAM as you can get.

Code: Select allconn=net.createConnection(net.TCP, 1)
i = 1 
conn:on("receive", function(conn,payload)
   if(i==1 and string.match(payload,"^220")) then
      print("Connected.")
      conn:send("EHLO\r\n")
   end
   if(i==2 and string.match(payload,"^250")) then
      conn:send("AUTH LOGIN\r\n")
   end
   if (i==3 and string.match(payload,"^334")) then
      conn:send("username\r\n")
   end
   if (i==4 and string.match(payload,"^334")) then
      conn:send("password\r\n")
   end
   if(i==5 and string.match(payload,"^235")) then
      print("Logged in.")
      conn:send("MAIL FROM: <xxx@gmail.com>\r\n")
   end
   if(i==6) then
      conn:send("RCPT TO: <yyy@gmail.com>\r\n")
   end
   if(i==7) then
      conn:send("DATA\r\n")
   end
   if(i==8) then
      conn:send("Subject: Test\r\n")
      conn:send("Test\r\n")
      conn:send(".\r\n")
   end
   if(i==9  and string.match(payload,"^250")) then
      print("Mail sent")
      conn:send("quit\r\n")
   end
   i=i+1
end)
conn:on("disconnection", function() print("disconnect") conn=nil end)
conn:connect(465,"64.233.164.108")
User avatar
By diddledad
#8285 Oskar,

I get a restart when running the latest code on FW 0.9.5 build 20150107. If I use the code example from 19 Jan and input through the console, the email gets sent using gmail. My heap shows 22144 after uploading init and your latest code. What is your heap right before your dofile? I really want this to work, thank you for your efforts!
User avatar
By diddledad
#8380 @oskar,

I've now tried FW 0.9.5 build 20150123, 20150126 and 20150127 but none seem to work for me. I'm uploading and doing my files with LuaLoader ver 0.82 but I still get hard restarts on my ESP-12. Everything works fine when sending commands through the console. I'm not giving up and will keep trying to debug.

@all,

Does anyone else have this code working without restarts?