I'm attempting to include a zip attachment with some html content in an email using apache-commons-email 1.1.
If i use this code, which sends an email without an attachment, the html body displays correctly.
HtmlEmail email = new HtmlEmail();
email.setMailSession(mailSession);
email.setSubject(subject);
email.addTo(to);
email.setFrom(from);
email.setHtmlMsg(body);
email.send();
however using the following, the email body is blank, and there is an html attachment (alongside my zip attachment) called "Part 1.2" containing what is supposed to be the email body:
HtmlEmail email = new HtmlEmail();
email.setMailSession(mailSession);
email.setSubject(subject);
email.addTo(to);
email.setFrom(from);
email.setHtmlMsg(body);
ByteArrayDataSource bads = new ByteArrayDataSource(zip, "application/zip");
email.attach(bads, "files.zip", "files");
email.send();
what can i do to avoid this problem?
ps i've tried to upgrade to commons-email 1.2 but maven breaks downloading it from refractions.net for some reason.