sendmail

Michael Ingraham 2019-10-21 09:32:00 -04:00
parent f31f946a36
commit b9acfef2ca
1 changed files with 12 additions and 27 deletions

@ -24,7 +24,7 @@ USE_SCRIPT_SUB_COMMAND | enables invoking named script subroutines via the Conso
USE_SCRIPT_HUE | enable `>H` section (Alexa Hue emulation) USE_SCRIPT_HUE | enable `>H` section (Alexa Hue emulation)
USE_SCRIPT_STATUS | enable `>U` section (receive JSON payloads) USE_SCRIPT_STATUS | enable `>U` section (receive JSON payloads)
SUPPORT_MQTT_EVENT | enables support for subscribe unsubscribe SUPPORT_MQTT_EVENT | enables support for subscribe unsubscribe
USE_SENDMAIL | enables support for sending e-mail and enables the `>m` section USE_SENDMAIL | enable `>m` section and support for sending e-mail
USE_SCRIPT_WEB_DISPLAY | enable `>W` section (modify web UI) USE_SCRIPT_WEB_DISPLAY | enable `>W` section (modify web UI)
USE_TOUCH_BUTTONS | enable virtual touch button support with touch displays USE_TOUCH_BUTTONS | enable virtual touch button support with touch displays
USE_WEBSEND_RESPONSE | enable receiving the response of a [`WebSend`](Commands#websend) command (received in section E) USE_WEBSEND_RESPONSE | enable receiving the response of a [`WebSend`](Commands#websend) command (received in section E)
@ -69,6 +69,7 @@ To save code space almost no error messages are provided. However it is taken ca
- The script itself can't be specified because the size would not fit the MQTT buffers - The script itself can't be specified because the size would not fit the MQTT buffers
**Script Sections** **Script Sections**
_Section descriptors (e.g., `>E`) are **case sensitive**_
>`>D ssize` >`>D ssize`
ssize = optional max string size (default=19) ssize = optional max string size (default=19)
define and init variables here, must be the first section, no other code allowed define and init variables here, must be the first section, no other code allowed
@ -85,7 +86,7 @@ To save code space almost no error messages are provided. However it is taken ca
Memory is dynamically allocated as a result of the D section. Memory is dynamically allocated as a result of the D section.
Copying a string to a number or reverse is supported Copying a string to a number or reverse is supported
>`>B` _(note upper case)_ >`>B`
executed on BOOT time and on save script executed on BOOT time and on save script
>`>E` >`>E`
@ -343,9 +344,13 @@ if ((a==b) and ((c==d) or (c==e)) and (s!="x"))
**E-mail** **E-mail**
`#define USE_SENDMAIL` `#define USE_SENDMAIL`
(this also enables TLS as sendmail uses SSL) Enabling this feature also enables [Tasmota TLS](TLS) as `sendmail` uses SSL.
`sendmail [server:port:user:passwd:from:to:subject] msg` `sendmail [server:port:user:passwd:from:to:subject] msg`
Example:
`sendmail [smtp.gmail.com:465:user:passwd:sender@gmail.com:rec@gmail.com:alarm] %string%`
The following parameters can be specified during compilation via `#define` directives in `user_config_override.h`: The following parameters can be specified during compilation via `#define` directives in `user_config_override.h`:
* `EMAIL_SERVER` * `EMAIL_SERVER`
* `EMAIL_PORT` * `EMAIL_PORT`
@ -353,32 +358,12 @@ The following parameters can be specified during compilation via `#define` direc
* `EMAIL_PASSWORD` * `EMAIL_PASSWORD`
* `EMAIL_FROM` * `EMAIL_FROM`
To use any of these values, pass an `*` as its corresponding argument placeholder. For example: To use any of these values, pass an `*` as its corresponding argument placeholder.
`sendmail [*:*:*:*:*:to:subject] msg`
if msg is a `*` character you may specify the email body in the >m section (must end with an `#` character)
Example: Example:
\>D 25 `sendmail [*:*:*:*:*:rec@gmail.com:theSubject] theMessage`
day1=0
et=0
to="\<mrx@gmail.com\>"
\>T Instead of passing the `msg` as a string constant, the body of the e-mail message may also be composed using the script `>m` _(note lower case)_ section. The specified text in this script section must end with an `#` character. `sendmail` will use the `>m` section if `*` is passed as the `msg` parameter.
et=ENERGY#Total [Example](Script-Cookbook#Send-e-mail)
\>S
; send on midnight
day1=day
if chg[day1]>0
then
`=>sendmail [*:*:*:*:*:%to%:energy report]*`
endif
\>b
email report at %tstamp%
your power consumption today was %et% KWh
\#
**Subscribe, Unsubscribe** **Subscribe, Unsubscribe**
`#define SUPPORT_MQTT_EVENT` `#define SUPPORT_MQTT_EVENT`