return new SendInvitationResult(emailSent);
}
private void sendEmail(String emailFrom, String emailTo, String token) throws AddressException, MessagingException, IOException{
Locale locale = requestProvider.get().getLocale();
ChangestuffsMessages translator = GWTI18N.create(ChangestuffsMessages.class, locale.toString());
log.info("locale: "+locale);
Session session = Session.getDefaultInstance(props, null);
MimeMessage msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(emailFrom));
msg.addRecipient(Message.RecipientType.TO, new InternetAddress(emailTo));
msg.setSubject(translator.inviteContact(emailFrom));
String body = htmlEngine.htmlInviteContact(locale, emailTo, emailFrom, DOMAIN, CANCEL, token);
msg.setContent(body, "text/html; charset=utf-8");
log.info("Trying to send email: "+body);
Transport.send(msg);
}