How to send email with html content

Hi there,
I am able to send gmail with (smtp has been correctly configured in
EmailInfo emailInfo = new EmailInfo( "", //recipients
"Send text email via Cuba", // subject
"Sending regular text email works fine."); //email content

Of cause followed Cuba manual:

Now I would like to send gmail with html content. As a test, I simply replaced the email content above to:

This is an test html email.

and I received:

This is an test html email.

Apparently html content is not rendered.

I found this article using MimeMessage to send html email:

I have not tried personally. But just wondering if Cuba platform support html email? If yes, any code snippet or example would be much appreciated.



in the code of the platform you’ll find the following method to determine the the content body type from the body of the email:
EmailSender. getContentBodyType. As you see in line 114 there is a check if the content starts with a html tag: <html>. In this case it will handle the body as html and set the correct content type afterwards.

So you should probably just add the tag and it will work.


1 Like

It works like a charm. Thanks Mario for the swift reply.

I followed your instructions. Since my html email content is lengthy, I use an online tool:
to minimize it, make sure it starts with …