I have a software to send emails that use apache commons email to send mail html, I have in the database also a string that represents a base64 image example data:image/png;base64,iVBORw0K ....
I tried to use the html img tag to send this email but it did not work, I found some tutorials that teach using an internet image like this for example. link
I would like to know if someone can help me convert this string into an image, an attachment in the email and use it in the body of the email using api apache commons email
Method to send the email this way
public String enviarEmail(Email mail) throws Exception {
try {
HtmlEmail email = new HtmlEmail();
email.setCharset(EmailConstants.UTF_8);
email.setHostName("myHost");
email.setStartTLSEnabled(true);
email.setSmtpPort(99);
String[] destinatarios =(String[])mail.getLstDestinatarios().toArray(new String[0]);
email.addBcc(destinatarios);
email.setFrom(mail.getRemetente());
email.setSubject(mail.getAssunto());
email.setHtmlMsg(mail.getMensagem());
email.send();
return "email enviado com sucesso";
} catch (Exception e) {
e.printStackTrace();
throw new WebApplicationException(e);
}