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

New Line Character in the message #7

Closed kamranrasul closed 4 years ago

kamranrasul commented 4 years ago

Hi Guys,

Indeed the EMailSender works perfectly. I was trying to send a message as 5-8 lines/ paragraph but the message received in Gmail doesn't contain any new lines but only spaces.

Am I using them correctly? Please help!

xreef commented 4 years ago

Hi kamranrasul, with kind of character you use? \r \n?? You can also use HTML notation, and with
you can obtain the result. Bye Renzo

kamranrasul commented 4 years ago

Thanks for the response Renzo!

I’m using both \n and \r.

I’m very new to esp32 and especially the email setup. Can you please shed some more detail on you suggestion?

I’ve tried ESP32_MailClient.h and it works fine with Arduino but when I try it with Visual Studio Code, PlatformIO, there are too many compilation errors in the library.

xreef commented 4 years ago

I think that I undestand the problem. In my library I try to give all the possibility, and as default the body of email si in HTML format, for example you can write a text like so

    EMailSender::EMailMessage message;
    message.subject = "Soggetto";
    message.message = "<img src='https://www.mischianti.org/wp-content/uploads/2020/01/logo256.jpg'/><br><br>Ciao come stai<br>io bene.<br>Login set ok;<br>This is my link <a href='www.mischianti.org'>Mischianti's Blog</a>";

and you receive an email like so

image

but if you want sent a simple email in TEXT format you must specify the correct mime type, so you must write an email like so

    EMailSender::EMailMessage message;
    message.subject = "Soggetto";
    message.message = "Ciao come stai\nio bene.\nLogin set ok;";
    message.mime = MIME_TEXT_PLAIN;

And in TEXT format line feed and carraige return work fine.

Give me a feedback, but I think the problem is this, you can try to use text line feed with HTML format.

Bye Renzo

kamranrasul commented 4 years ago

I will give it a try. And update you.