Closed PHPJJ closed 2 years ago
You have syntax errors in the sendmail command, lose those <>
@sfromis those < >
are required on ESP8266
https://github.com/arendst/Tasmota/issues/14404#issuecomment-1024884991
I used same command in project with version 8.5.1 also in a script. Even if syntaxis is incorrect it schould not generatie wdt/reboot. I copy/paste the command line from the script to console and it sends the mail. See the first few lines of the console log dump.
could not reproduce the issue. however ESP8266 sendmail in scripts is very critical due to possible memory issues. check your free ram memory. may also be a stack problem. email driver itself has not changed between 8.5 and 11.0
I have been investigating problem a little further and found a way to recreate. I found a way to recreate the problen that might help investigation.
This is what I did:
1 – Erased flach in Wemos D1 Mini Pro 2 - Took a fresh copy of tasmota 11.0.0.1 from the zip I downloaded. 3 - Verified compile with no change 4 – Recopiled with following in user_config_override.h
5 - I tested the sendmail line from console. Works OK.
6 - Use the following script, simplified from script I want to use.
D cnt=0 th=0 tm=0 t:altm=0 punct=":" tmp=0 alrm=1 alrmdur=0 tt=0 hm=0
; mail bdy
m Email raport van: %tstamp%\n #
W Tijd %0th%%punct%%0tm%
B spinm(13 2) spinm(14 1) spin(14 0) =>print Restarting
T F S th=int(time/60) tm=time-(th*60) if tm<10 { punct=":0" } else{punct=":" }
alrm=pin[13] if ((upsecs%10==0)or(alrm==0)) { spin(14 1) } else { spin(14 0) }
if ((alrm==0)and(altm==0)){ =>sendmail [smtp.gmail.com:465:nnnnnnnnn:nnnnnnnnn:tasmota2@gmail.com:my.gmail@gmail.com:stookkelder]water detected. altm=100 alrmdur=alrmdur+1 } =>print %upsecs% Alarm:%0alrm% Atimer:%0altm% Duration:%0alrmdur%
The script above, e-mail is send. So that does not recreate the problem. However I want to use the sendmail from a subroutine.
7 - Changed the script to: . . . if ((alrm==0)and(altm==0)){ =#sendreport(stookkelder) altm=100 alrmdur=alrmdur+1 } =>print %upsecs% Alarm:%0alrm% Atimer:%0altm% Duration:%0alrmdur%
=>sendmail [smtp.gmail.com:465:nnnnnnnnn:nnnnnnnnn:tasmota2@gmail.com:my.gmail@gmail.com:stookkelder]water detected.
Now sendmail fails in 3:57:43.063 RSL: INFO3 = {"Info3":{"RestartReason":{"Exception":4,"Reason":"Software Watchdog","EPC":["401076f4","00000000","00000000"],"EXCVADDR":"00000000","DEPC":"00000000","CallChain":["40250872","40250872","40245567","40266254","40266200","40265dde","40299b14","40245680","40245835","402458f9","40254d50","40254d50","402310df","4024f5dc","4024f618","40231507","401018ef","402a21ab","4024944a","40257400","40231582","40293548","40293548","4021ed88","4029352c","402934fc","401011e0","40227983","40295e9a","40295d34","40217656"]},"BootCount":18}}
Note: I do not (yet) use the (subj) in this test, nor do I use the .m mail body option. If I do the error persists, so keep it the simples way to recreate.
This means, moving the sendmail command to the subroutine causes the problem to show.
Before reporting the original problem I’m sure I tested the direct sendmail as in the first script. This lets me believe that there is some memory of timing critical flaw that gets wors if more options are added such as support for SHT3X etc. Hope this helps to recreate the problem.
as i said memory is very limited and mail uses TLS which also consumes memory. if you put sendmail in a subroutine you use an additional portion of stack which could lead to a stack overflow. it may well be that stack usage has changed between 8.5 and 11.0 to reliably send emails better use an ESP32
As explained in the above answer it's all about memory.
I have been experimenting and ofcause removed the sendmail from subroutine. Standard tasmota with only script and sendmail added will execute sendmail. However if I add i2c and sht3x etc, even outside subroutine sendmail is unreliable (sometimes error "wrong" parameters.) I will take an other route and start from minimal and add just what I need. Thanks for your efforts.
PROBLEM DESCRIPTION
A clear and concise description of what the problem is.
REQUESTED INFORMATION
Make sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!
Backlog Template; Module; GPIO 255
:Status 0
:TO REPRODUCE
Steps to reproduce the behavior: send mail from script and from console command line
EXPECTED BEHAVIOUR
A clear and concise description of what you expected to happen. Well, no wtd
SCREENSHOTS
If applicable, add screenshots to help explain your problem.
ADDITIONAL CONTEXT
Add any other context about the problem here. Self build, platfornIO, with config_ override:
ifndef USE_SHT3X
define USE_SHT3X
endif
ifdef USE_RULES
undef USE_RULES
define USE_SCRIPT
endif
ifndef USE_SCRIPT_WEB_DISPLAY
define USE_SCRIPT_WEB_DISPLAY
endif
ifndef USE_GOOGLE_CHARTS
define USE_GOOGLE_CHARTS
endif
ifndef USE_SENDMAIL
define USE_SENDMAIL
endif
ifndef USE_UFILESYS
define USE_UFILESYS
endif
ifdef USE_DOMOTICZ
undef USE_DOMOTICZ
endif
Setting Debug in mail ino does not give differen output nor result. (Please, remember to close the issue when the problem has been addressed)