diff --git a/docs/source/Notify/N001.rst b/docs/source/Notify/N001.rst
index e5bb6338d8..c5bea31931 100644
--- a/docs/source/Notify/N001.rst
+++ b/docs/source/Notify/N001.rst
@@ -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
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
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 `_ .
+
+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).
diff --git a/docs/source/Notify/NotifyEmail2.png b/docs/source/Notify/NotifyEmail2.png
index 76d9cb5760..a0b46fc3b3 100644
Binary files a/docs/source/Notify/NotifyEmail2.png and b/docs/source/Notify/NotifyEmail2.png differ
diff --git a/src/_N001_Email.cpp b/src/_N001_Email.cpp
index a3080ae7df..4bc89182de 100644
--- a/src/_N001_Email.cpp
+++ b/src/_N001_Email.cpp
@@ -69,6 +69,7 @@ bool NPlugin_001(NPlugin::Function function, struct EventStruct *event, String&
MakeNotificationSettings(NotificationSettings);
LoadNotificationSettings(event->NotificationIndex, (uint8_t *)&NotificationSettings, sizeof(NotificationSettingsStruct));
NotificationSettings.validate();
+
String subject = NotificationSettings.Subject;
String body = NotificationSettings.Body;
diff --git a/src/src/WebServer/NotificationPage.cpp b/src/src/WebServer/NotificationPage.cpp
index 0f1f60899d..216481ecc4 100644
--- a/src/src/WebServer/NotificationPage.cpp
+++ b/src/src/WebServer/NotificationPage.cpp
@@ -95,7 +95,8 @@ void handle_notifications() {
strncpy_webserver_arg(NotificationSettings.User, F("username"));
strncpy_webserver_arg(NotificationSettings.Pass, F("password"));
strncpy_webserver_arg(NotificationSettings.Body, F("body"));
-// copyFormPassword(F("password"), NotificationSettings.Pass, sizeof(NotificationSettings.Pass));
+
+ // copyFormPassword(F("password"), NotificationSettings.Pass, sizeof(NotificationSettings.Pass));
}
}
addHtmlError(SaveNotificationSettings(notificationindex, reinterpret_cast(&NotificationSettings),
@@ -218,6 +219,14 @@ void handle_notifications() {
{
if (Notification[NotificationProtocolIndex].usesMessaging)
{
+ if (NotificationSettings.Port == 0) {
+# if FEATURE_EMAIL_TLS
+ NotificationSettings.Port = 465;
+# else // if FEATURE_EMAIL_TLS
+ NotificationSettings.Port = 25;
+# endif // if FEATURE_EMAIL_TLS
+ }
+
addFormSubHeader(F("SMTP Server Settings"));
addFormTextBox(F("Domain"), F("domain"), NotificationSettings.Domain, sizeof(NotificationSettings.Domain) - 1);
addFormTextBox(F("Server"), F("server"), NotificationSettings.Server, sizeof(NotificationSettings.Server) - 1);
@@ -226,11 +235,11 @@ void handle_notifications() {
NotificationSettings.Port,
1,
65535);
-#if FEATURE_EMAIL_TLS
- addFormNote(F("default port SSL: 465, TLS: 587"));
-#else
- addFormNote(F("SSL/TLS servers NOT supported!"));
-#endif
+# if FEATURE_EMAIL_TLS
+ addFormNote(F("default port SSL: 465"));
+# else // if FEATURE_EMAIL_TLS
+ addFormNote(F("default port: 25, SSL/TLS servers NOT supported!"));
+# endif // if FEATURE_EMAIL_TLS
if ((NotificationSettings.Timeout_ms < NPLUGIN_001_MIN_TM) ||
(NotificationSettings.Timeout_ms > NPLUGIN_001_MAX_TM))
@@ -254,15 +263,17 @@ void handle_notifications() {
ZERO_TERMINATE(NotificationSettings.Pass);
addFormSubHeader(F("Credentials"));
- addFormTextBox(F("Username"), F("username"), NotificationSettings.User, sizeof(NotificationSettings.User) - 1);
- addFormTextBox(F("Password"), F("password"), NotificationSettings.Pass, sizeof(NotificationSettings.Pass) - 1);
-// addFormPasswordBox(F("Password"), F("password"), NotificationSettings.Pass, sizeof(NotificationSettings.Pass) - 1);
+ addFormTextBox(F("Username"), F("username"), NotificationSettings.User, sizeof(NotificationSettings.User) - 1);
+ addFormTextBox(F("Password"), F("password"), NotificationSettings.Pass, sizeof(NotificationSettings.Pass) - 1);
+
+ // addFormPasswordBox(F("Password"), F("password"), NotificationSettings.Pass, sizeof(NotificationSettings.Pass) -
+ // 1);
addFormSubHeader(F("Email Attributes"));
- addFormTextBox(F("Sender"), F("sender"), NotificationSettings.Sender, sizeof(NotificationSettings.Sender) - 1);
- addFormTextBox(F("Receiver"), F("receiver"), NotificationSettings.Receiver, sizeof(NotificationSettings.Receiver) - 1);
- addFormTextBox(F("Subject"), F("subject"), NotificationSettings.Subject, sizeof(NotificationSettings.Subject) - 1);
+ addFormTextBox(F("Sender"), F("sender"), NotificationSettings.Sender, sizeof(NotificationSettings.Sender) - 1);
+ addFormTextBox(F("Receiver"), F("receiver"), NotificationSettings.Receiver, sizeof(NotificationSettings.Receiver) - 1);
+ addFormTextBox(F("Subject"), F("subject"), NotificationSettings.Subject, sizeof(NotificationSettings.Subject) - 1);
addRowLabel(F("Body"));
addHtml(F("