From 1959291bdd6d199a5bd8d81d4bfec6298866a751 Mon Sep 17 00:00:00 2001 From: Vic Date: Sat, 21 Nov 2020 18:17:46 +0100 Subject: [PATCH] corrected a mixup of MIME multipart and simple plain text email messages --- tasmota/sendemail.ino | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tasmota/sendemail.ino b/tasmota/sendemail.ino index c43239a7e..9480ede7b 100644 --- a/tasmota/sendemail.ino +++ b/tasmota/sendemail.ino @@ -331,11 +331,6 @@ String buffer; goto exit; } - buffer = F("MIME-Version: 1.0\r\n"); - client->print(buffer); - buffer = F("Content-Type: Multipart/mixed; boundary=frontier\r\n"); - client->print(buffer); - buffer = F("From: "); buffer += from; client->println(buffer); @@ -350,22 +345,27 @@ String buffer; #endif buffer = F("Subject: "); buffer += subject; - buffer += F("\r\n"); client->println(buffer); #ifdef DEBUG_EMAIL_PORT AddLog_P(LOG_LEVEL_INFO, PSTR("%s"),buffer.c_str()); #endif - #ifdef USE_SCRIPT if (*msg=='*' && *(msg+1)==0) { + buffer = F("MIME-Version: 1.0\r\n"); + client->print(buffer); + buffer = F("Content-Type: Multipart/mixed; boundary=frontier\r\n\r\n"); + client->print(buffer); + g_client=client; script_send_email_body(xsend_message_txt); } else { +#endif + buffer = F("\r\n"); + client->print(buffer); client->println(msg); +#ifdef USE_SCRIPT } -#else - client->println(msg); #endif client->println('.'); #ifdef DEBUG_EMAIL_PORT