throw new RuntimeException("Opening Transport", e);
}
try {
InternetAddress address = new InternetAddress(email);
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(configuration.getFromAddress()));
msg.setRecipient(Message.RecipientType.TO, address);
String title = "GVS Login Link";
try {
msg.setSubject(MimeUtility.encodeText(title, "UTF-8", null));
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
msg.setSentDate(new java.util.Date());
// create and fill the first message part
MimeBodyPart plainTextVersion = new MimeBodyPart();
plainTextVersion.setDataHandler(new DataHandler(textDataSource));
MimeBodyPart htmlPart = new MimeBodyPart();
htmlPart.setDataHandler(new DataHandler(htmlDataSource));
// create the Multipart
// and its parts to it
Multipart bodyAlternatives = new MimeMultipart("alternative");
bodyAlternatives.addBodyPart(plainTextVersion);
htmlPart.setHeader("Content-Type", "text/html; charset=UTF-8");
bodyAlternatives.addBodyPart(htmlPart);
// mbp1.setHeader("Content-Language", "fr");
// add the Multipart to the message
Multipart mainMultipart = new MimeMultipart();
BodyPart body = new MimeBodyPart();
body.setContent(bodyAlternatives);
mainMultipart.addBodyPart(body);
// mainMultipart.addBodyPart(getSerialializerRDFPart(mailModel));
msg.setContent(mainMultipart);
log.debug("mesage ready, sending");
Transport.send(msg);
/*
* Reusing conncection: (problem:isp limits) Address[] recipients = new
* Address[1]; recipients[0] = recipient; transport.sendMessage(msg,