Skip to content

Commit

Permalink
Merge pull request letscontrolit#5135 from TD-er/feature/email_TLS
Browse files Browse the repository at this point in the history
[Email] Add SSL support for sending email
  • Loading branch information
TD-er authored Oct 7, 2024
2 parents 4845f91 + 5397bc8 commit 7a9b93b
Show file tree
Hide file tree
Showing 165 changed files with 31,096 additions and 646 deletions.
62 changes: 47 additions & 15 deletions docs/source/Notify/N001.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,32 +76,64 @@ From the *Notifications* page, press *Edit* on an available *Nr* option. Next, C
.. image:: NotifyEmail2.png
:alt: Email Configuration Example

* **Domain :** Mail provider domain.
* **Server :** Mail server address (DNS or IP number). Must support non-secure SMTP.
* **Port :** Server port number. TLS / SSL ports are NOT supported.
* **Timeout :** Maximum allowed time for server reply. Increase value if server timeouts occur.
* **Sender :** Sender's email address ("From:").
* **Receiver :** Recipient's email address ("To:"). Multiple allowed, use comma (,) between each address.
* **Subject :** Text for email's subject line.
* **User :** Server user name.
* **Pass :** Server password.
* **Body :** Message text. System variables allowed. Use <br> for new line. Maximum 512 characters.
* SMTP Server Settings

* **Domain :** Mail provider domain.
* **Server :** Mail server address (DNS or IP number). Must support non-secure SMTP.
* **Port :** Server port number. (see note below)
* **Timeout :** Maximum allowed time for server reply. Increase value if server timeouts occur.

* Credentials

* **Username :** Server user name.
* **Password :** Server password.

* Email Attributes

* **Sender :** Sender's email address ("From:").
* **Receiver :** Recipient's email address ("To:"). Multiple allowed, use comma (,) between each address.
* **Subject :** Text for email's subject line.
* **Body :** Message text. System variables allowed. Use <br> for new line. Maximum 512 characters.

* **Enabled :** Check this box to enable the email feature.

Be sure to press *Submit* to save your settings.

Note: For more flexibility, there are :ref:`adv_feat` within the notify command for changing the recipient(s), subject line, and message body.

.. note:: Whenever the email service allows to use temporary passwords, please use those to make sure your main password isn't stored (unencrypted) on any ESPEasy device.
For example, GMail allows to use `App Passwords <https://support.google.com/accounts/answer/185833?hl=en>`_ .

SSL Port
--------

Added: 2024-10-07

Only ESP32-xx builds will have SSL support for sending emails.
ESP8266 simply doesn't have enough free memory available to setup a SSL connection.

Only SSL port 465 is supported, as for using port 587 (typically named "TLS") extra steps are required to make a connection.
This may be added later.
|
Email Server Requirements
--------------------------
Email Server Requirements with SSL
----------------------------------

For ESP32-builds made after 2024-10-07, it is possible to use SSL (port 465) to connect to a mail server.
Make sure the mail-server supports this port as the alternative on port 587 is not yet supported.

Not all hosting providers support this port as it is considered 'deprecated'.
However large mail providers like GMail, AOL and others still support this port.


Email Server Requirements without SSL
-------------------------------------

ESPEasy doesn't support the SSL protocol.
ESPEasy doesn't support the SSL protocol on ESP8266
Unfortunately most Email service providers ended support for non-secure SMTP (without TLS / SSL) several years ago.
This means that ESPEasy's email is **not** directly compatible with popular providers such as gmail.com, yahoo.com, aol.com, and many others.
This means that for ESP8266 ESPEasy's email is **not** directly compatible with popular providers such as gmail.com, yahoo.com, aol.com, and many others.

But there are two workarounds for the SSL issue, as follows:
However, there are two workarounds for the SSL issue, as follows:

* Operate a mail server inside your local network.
* Use an SMTP Email account from a provider that still supports non-secure SMTP (e.g. SMTP2go.com, smart-mail.de).
Expand Down
Binary file modified docs/source/Notify/NotifyEmail2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
69 changes: 69 additions & 0 deletions lib/lib_ssl/bearssl-esp8266/conf/Unix.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Configuration for a native build on a generic Unix-like system.

# Build directory.
BUILD = build

# Extension for executable files.
E =

# Extension for object files.
O = .o

# Prefix for library file name.
LP = lib

# Extension for library file name.
L = .a

# Prefix for DLL file name.
DP = lib

# Extension for DLL file name.
D = .so

# Output file names can be overridden directly. By default, they are
# assembled using the prefix/extension macros defined above.
# BEARSSLLIB = libbearssl.a
# BEARSSLDLL = libbearssl.so
# BRSSL = brssl
# TESTCRYPTO = testcrypto
# TESTSPEED = testspeed
# TESTX509 = testx509

# File deletion tool.
RM = rm -f

# Directory creation tool.
MKDIR = mkdir -p

# C compiler and flags.
CC = cc
CFLAGS = -W -Wall -Os -fPIC -DBR_SLOW_MUL15=1
CCOUT = -c -o

# Static library building tool.
AR = ar
ARFLAGS = -rcs
AROUT =

# DLL building tool.
LDDLL = cc
LDDLLFLAGS = -shared
LDDLLOUT = -o

# Static linker.
LD = cc
LDFLAGS =
LDOUT = -o

# C# compiler; we assume usage of Mono.
MKT0COMP = mk$PmkT0.sh
RUNT0COMP = mono T0Comp.exe

# Set the values to 'no' to disable building of the corresponding element
# by default. Building can still be invoked with an explicit target call
# (e.g. 'make dll' to force build the DLL).
#STATICLIB = no
#DLL = no
#TOOLS = no
#TESTS = no
12 changes: 12 additions & 0 deletions lib/lib_ssl/bearssl-esp8266/conf/Unix32.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Example configuration file for compiling on a Unix-like system with
# GCC, targeting a 32-bit output. Moreover, it enables the "LOMUL" setting
# to make the code select the "small" integer implementations (i15, m15,
# ctmul32...), which is not necessarily a good idea for performance, but
# handy for tests.

include conf/Unix.mk

BUILD = build32
CFLAGS = -W -Wall -Os -fPIC -m32 -DBR_LOMUL -DBR_SLOW_MUL15=1
LDFLAGS = -m32
LDDLLFLAGS = -shared -m32
11 changes: 11 additions & 0 deletions lib/lib_ssl/bearssl-esp8266/conf/UnixClang.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Example configuration file for compiling on a Unix-like system with
# clang as compiler instead of gcc.

# We are on a Unix system so we assume a Single Unix compatible 'make'
# utility, and Unix defaults.
include conf/Unix.mk

BUILD = bclang
CC = clang
LD = clang
LDDLL = clang
70 changes: 70 additions & 0 deletions lib/lib_ssl/bearssl-esp8266/conf/Win.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Configuration for a native build on a Windows system with Visual Studio.

# Build directory.
BUILD = build

# Extension for executable files.
E = .exe

# Extension for object files.
O = .obj

# Prefix for static library file name.
LP =

# Extension for static library file name. We add an 's' so that the
# name is distinct from the 'import library' generated along with the DLL.
L = s.lib

# Prefix for DLL file name.
DP =

# Extension for DLL file name.
D = .dll

# Output file names can be overridden directly. By default, they are
# assembled using the prefix/extension macros defined above.
# BEARSSLLIB = bearssls.lib
# BEARSSLDLL = bearssl.dll
# BRSSL = brssl.exe
# TESTCRYPTO = testcrypto.exe
# TESTSPEED = testspeed.exe
# TESTX509 = testx509.exe

# File deletion tool.
RM = del /Q

# Directory creation tool.
MKDIR = mkdir

# C compiler and flags.
CC = cl
CFLAGS = -nologo -W2 -O2
CCOUT = -c -Fo

# Static library building tool.
AR = lib
ARFLAGS = -nologo
AROUT = -out:

# DLL building tool.
LDDLL = cl
LDDLLFLAGS = -nologo -LD -MT
LDDLLOUT = -Fe

# Static linker.
LD = cl
LDFLAGS = -nologo
LDOUT = -Fe

# C# compiler.
MKT0COMP = mk$PmkT0.cmd
RUNT0COMP = T0Comp.exe

# Set the values to 'no' to disable building of the corresponding element
# by default. Building can still be invoked with an explicit target call
# (e.g. 'make dll' to force build the DLL).
#STATICLIB = no
#DLL = no
#TOOLS = no
#TESTS = no
4 changes: 2 additions & 2 deletions lib/lib_ssl/bearssl-esp8266/conf/esp8266.mk
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ BUILD = esp8266
# C compiler, linker, and static library builder.
TOOLCHAIN_PREFIX := xtensa-lx106-elf-
CC := $(TOOLCHAIN_PREFIX)gcc
CFLAGS = -W -Wall -g -O2 -Wpointer-arith -Wl,-EL -nostdlib -mlongcalls -mno-text-section-literals -ffunction-sections -fdata-sections -Werror
CFLAGS += -D__ets__ -DICACHE_FLASH -DESP8266 -DBR_SLOW_MUL15=1
CFLAGS = -W -Wall -g -O2 -Wpointer-arith -Wl,-EL -nostdlib -mlongcalls -mno-text-section-literals -ffunction-sections -fdata-sections -Werror -free -fipa-pta -mextra-l32r-costs=5
CFLAGS += -D__ets__ -DICACHE_FLASH -DESP8266 -DBR_SLOW_MUL15=1 -DPGM_READ_UNALIGNED=0
LD := $(TOOLCHAIN_PREFIX)ld
AR := $(TOOLCHAIN_PREFIX)ar

Expand Down
21 changes: 21 additions & 0 deletions lib/lib_ssl/bearssl-esp8266/conf/esp8266m32.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Configuration for compiling to an ESP8266 from a UNIX system

# We are on a Unix system so we assume a Single Unix compatible 'make'
# utility, and Unix defaults.
include conf/Unix.mk

# We override the build directory.
BUILD = esp8266m32

# C compiler, linker, and static library builder.
TOOLCHAIN_PREFIX := xtensa-lx106-elf-
CC := $(TOOLCHAIN_PREFIX)gcc
CFLAGS = -W -Wall -g -Os -Wpointer-arith -Wl,-EL -nostdlib -mlongcalls -mno-text-section-literals -ffunction-sections -fdata-sections -Werror
CFLAGS += -D__ets__ -DICACHE_FLASH -DESP8266 -DESP8266M32 -DPGM_READ_UNALIGNED=0
LD := $(TOOLCHAIN_PREFIX)ld
AR := $(TOOLCHAIN_PREFIX)ar

# We compile only the static library.
DLL = no
TOOLS = no
TESTS = no
22 changes: 22 additions & 0 deletions lib/lib_ssl/bearssl-esp8266/conf/pico.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Configuration for compiling to a Pico from a UNIX system

# We are on a Unix system so we assume a Single Unix compatible 'make'
# utility, and Unix defaults.
include conf/Unix.mk

# We override the build directory.
BUILD = pico

# C compiler, linker, and static library builder.
TOOLCHAIN_PREFIX := arm-none-eabi-
CC := $(TOOLCHAIN_PREFIX)gcc
CFLAGS = -W -Wall -g -O2 -Wpointer-arith -Wl,-EL -nostdlib -ffunction-sections -fdata-sections -Werror -free -fipa-pta
CFLAGS += -DICACHE_FLASH -DBR_SLOW_MUL15=1 -DPGM_READ_UNALIGNED=0 -DBR_USE_PICO_RAND
CFLAGS += -march=armv6-m -mcpu=cortex-m0plus -mthumb
LD := $(TOOLCHAIN_PREFIX)ld
AR := $(TOOLCHAIN_PREFIX)ar

# We compile only the static library.
DLL = no
TOOLS = no
TESTS = no
22 changes: 22 additions & 0 deletions lib/lib_ssl/bearssl-esp8266/conf/pico2.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Configuration for compiling to a Pico from a UNIX system

# We are on a Unix system so we assume a Single Unix compatible 'make'
# utility, and Unix defaults.
include conf/Unix.mk

# We override the build directory.
BUILD = pico2

# C compiler, linker, and static library builder.
TOOLCHAIN_PREFIX := arm-none-eabi-
CC := $(TOOLCHAIN_PREFIX)gcc
CFLAGS = -W -Wall -g -O2 -Wpointer-arith -Wl,-EL -nostdlib -ffunction-sections -fdata-sections -Werror -free -fipa-pta
CFLAGS += -DICACHE_FLASH -DBR_SLOW_MUL15=1 -DPGM_READ_UNALIGNED=0 -DBR_USE_PICO_RAND
CFLAGS += -march=armv8-m.main+fp+dsp -mfloat-abi=softfp -mcpu=cortex-m33 -mthumb
LD := $(TOOLCHAIN_PREFIX)ld
AR := $(TOOLCHAIN_PREFIX)ar

# We compile only the static library.
DLL = no
TOOLS = no
TESTS = no
22 changes: 22 additions & 0 deletions lib/lib_ssl/bearssl-esp8266/conf/pico2rv.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Configuration for compiling to a Pico from a UNIX system

# We are on a Unix system so we assume a Single Unix compatible 'make'
# utility, and Unix defaults.
include conf/Unix.mk

# We override the build directory.
BUILD = pico2rv

# C compiler, linker, and static library builder.
TOOLCHAIN_PREFIX := riscv32-unknown-elf-
CC := $(TOOLCHAIN_PREFIX)gcc
CFLAGS = -W -Wall -g -O2 -Wpointer-arith -Wl,-EL -nostdlib -ffunction-sections -fdata-sections -Werror -free -fipa-pta
CFLAGS += -DICACHE_FLASH -DBR_SLOW_MUL15=1 -DPGM_READ_UNALIGNED=0 -DBR_USE_PICO_RAND
CFLAGS += -march=rv32imac_zicsr_zifencei_zba_zbb_zbs_zbkb -mabi=ilp32
LD := $(TOOLCHAIN_PREFIX)ld
AR := $(TOOLCHAIN_PREFIX)ar

# We compile only the static library.
DLL = no
TOOLS = no
TESTS = no
20 changes: 20 additions & 0 deletions lib/lib_ssl/bearssl-esp8266/conf/samd20.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Example configuration file for compiling for an Atmel SAM D20 Xplained
# Pro evaluation kit, on a Unix-like system, with a GNU toolchain.

# We are on a Unix system so we assume a Single Unix compatible 'make'
# utility, and Unix defaults.
include conf/Unix.mk

# We override the build directory.
BUILD = samd20

# C compiler, linker, and static library builder.
CC = arm-none-eabi-gcc
CFLAGS = -W -Wall -Os -mthumb -ffunction-sections -fdata-sections -mcpu=cortex-m0plus -DBR_ARMEL_CORTEXM_GCC
LD = arm-none-eabi-gcc
AR = arm-none-eabi-ar

# We compile only the static library.
DLL = no
TOOLS = no
TESTS = no
Loading

0 comments on commit 7a9b93b

Please sign in to comment.