xreef / EMailSender

Arduino, esp32, Esp8266 EMailSender with Arduino IDE, simple library to send email via smtp with attachments.
https://www.mischianti.org/category/my-libraries/emailsender-send-email-with-attachments/
MIT License
74 stars 26 forks source link

configuration of html or plain text #4

Closed barneyz closed 4 years ago

barneyz commented 4 years ago

it would be nice if EMailSender::EMailSender can config additional html or plain text, for testing i changed

client.println(F("Mime-Version: 1.0")); client.println(F("Content-Type: text/plain; charset=UTF-8")); client.println(F("Content-Transfer-Encoding: 7bit")); client.println(); String body = String(email.message) + "\r\n"; client.println(body); client.println(".");

instead of the original code

client.println(F("Mime-Version: 1.0")); client.println(F("Content-Type: text/html; charset=\"UTF-8\"")); client.println(F("Content-Transfer-Encoding: 7bit")); client.println(); String body = "<!DOCTYPE html><html lang=\"en\">" + String(email.message) + ""; client.println(body); client.println(".");

and it works fine.

xreef commented 4 years ago

Hi Barneyz, It's a good Idea, I'm going to add this features, but not soon, I have some activity to finish. I'd like to add the attach features also, but I need more time. Thanks for your suggest, bye Renzo

xreef commented 4 years ago

Hi Barneyz, I add a major update to this library, on this branch https://github.com/xreef/EMailSender/tree/AttachMimeAndArduinoPort now you can specify the mime type of the content, attach multiple files and now I granted support for Arduino (without SSL and TLS) esp8266 and esp32.

I add some examples for all.

Thanks for your support and I hope you'd like to test this library even if I don't already add a full documentation.

Bye Renzo

barneyz commented 4 years ago

Hi Renzo, thank you very much, "message.mime = MIME_TEXT_PLAIN;" works fine. And the workaround for compiling for ESP32 // Uncomment if you use esp8266 core <= 2.4.2

define ARDUINO_ESP8266_RELEASE_2_4_2

ist not needed any more :-) Bye Barney