--- sendmail
MY_EMAIL = "spender@yeah.net"
MY_EMAIL_B64 = "base64-encoded-email"
EMAIL_PASSWORD_B64 = "base64-encoded-password"
--In linux set command to get your base64 password just like:
--echo -n "hereisyoupassword"|base64
SMTP_SERVER = "smtp.yeah.net"
SMTP_PORT = 25
mail_to = "somebodyto@userdomain.com"
email_subject = ""
email_body = ""
count = 0
smtp_socket = nil
function display(sck,response)
local smtpCode
smtpCode=string.sub(response,1,3)
print(response)
if ( tonumber(smtpCode)>400) then
print("## Error detect! ")
return 1
else
print("-- Go on ..")
return 0
end
end
function do_next()
if(count == 0)then
count = count+1
local IP_ADDRESS = wifi.sta.getip()
smtp_socket:send("HELO "..IP_ADDRESS.."\r\n")
elseif(count==1
esp8266 自动发送邮件
最新推荐文章于 2024-03-10 21:09:18 发布
本文介绍了如何使用 ESP8266 模块通过 Lua 脚本实现自动发送邮件。示例代码中展示了设置 SMTP 服务器、编码密码、建立连接、发送邮件的详细步骤,包括如何附带设备状态报告。
摘要由CSDN通过智能技术生成