public void sendConfirmYourAccountEmail(
final SignUpBean user,
final String inviteCode) {
final MimeMessagePreparator preparator = new MimeMessagePreparator() {
public void prepare(MimeMessage mimeMessage) throws Exception {
final MimeMessageHelper message = new MimeMessageHelper(mimeMessage);
log.debug("confirm account to " + user.getEmail());
message.setTo(user.getEmail());
message.setSubject(buildSubject(
getMessageProperties("email.message.confirmation.message",
buildCurrentLocale(),
null)));
message.setFrom(noEmailResponse);
final Map<String, Object> model = new HashMap<String, Object>();
if (user.getFullName() == null) {
// build
user.setFullName(getMessageProperties("mail.message.default.user.full.presentation",
buildCurrentLocale(),
null));
} else {
// build anomymous the salute
final String _fullName = user.getFullName();
final StringBuffer salute = new StringBuffer(getMessageProperties("mail.message.default.user.presentation",
buildCurrentLocale(),
null));
salute.append(" ");
salute.append(_fullName);
user.setFullName(salute.toString());
}
getLogo(model);
model.put("user", user);
model.put("inviteCode", inviteCode);
model.put("domain", domainDefault);
model.put("successMessage", getMessageProperties("mail.message.registration.success", buildCurrentLocale(), null));
model.put("confirmMessage", getMessageProperties("mail.message.confirm.please", buildCurrentLocale(), null));
model.put("confirmMessageSubfooter", getMessageProperties("mail.message.confirm.subfooter", buildCurrentLocale(), null));
getGreetingMessage(model);
// create the template
final String text = VelocityEngineUtils.mergeTemplateIntoString(
velocityEngine, "/org/encuestame/business/mail/templates/confirm-your-account.vm",
model);
message.setText(text, Boolean.TRUE);
}
};
send(preparator);
}