コード例 #1
0
 private final SimpleMailMessage constructEmailMessage(
     final OnRegistrationCompleteEvent event, final User user, final String token) {
   final String recipientAddress = user.getEmail();
   final String subject = "Registration Confirmation";
   final String confirmationUrl = event.getAppUrl() + "/regitrationConfirm.html?token=" + token;
   final String message = messages.getMessage("message.regSucc", null, event.getLocale());
   final SimpleMailMessage email = new SimpleMailMessage();
   email.setTo(recipientAddress);
   email.setSubject(subject);
   email.setText(message + " \r\n" + confirmationUrl);
   email.setFrom(env.getProperty("support.email"));
   return email;
 }
コード例 #2
0
  private void confirmRegistration(final OnRegistrationCompleteEvent event) {
    final User user = event.getUser();
    final String token = UUID.randomUUID().toString();
    service.createVerificationTokenForUser(user, token);

    final SimpleMailMessage email = constructEmailMessage(event, user, token);
    mailSender.send(email);
  }