use of org.springframework.mail.SimpleMailMessage in project Internet-Software-Architectures by zivko11.
the class Mailing method sendRegistration.
public void sendRegistration(String mail, String token) {
String link = "localhost:8080/cinema-theatre/confirmatin.html?token=";
String subject = "Registration Confirmation";
String confirmationUrl = link + token;
String message = "Confirm your registration on this link: ";
SimpleMailMessage email = new SimpleMailMessage();
email.setTo(mail);
email.setSubject(subject);
email.setText(message + confirmationUrl);
mailSender.send(email);
}
use of org.springframework.mail.SimpleMailMessage in project uhgroupings by uhawaii-system-its-ti-iam.
the class EmailService method send.
public void send(Feedback feedback) {
if (isEnabled) {
logger.info("\n/********************************************************************************************/" + "\n\nSending email!\n\n" + "/********************************************************************************************/\n");
SimpleMailMessage msg = new SimpleMailMessage();
msg.setTo(to);
msg.setFrom(from);
String text = "";
String header = "Feedback Type: " + feedback.getType();
text += "Feedback reported by " + feedback.getName() + " using email " + feedback.getEmail() + "\n\n";
text += "Feedback: " + feedback.getMessage();
text += "Stacktrace: " + feedback.getExceptionError();
msg.setText(text);
msg.setSubject(header);
try {
javaMailSender.send(msg);
} catch (MailException ex) {
logger.error("Error", ex);
}
}
}
use of org.springframework.mail.SimpleMailMessage in project code-chill by CodeChillAlluna.
the class UserController method processForgotPasswordForm.
// Process form submission from forgotPassword page
@PostMapping(value = "/user/forgottenpassword")
public ResponseEntity<?> processForgotPasswordForm(@RequestBody String email) {
User user = urepo.findByEmail(email);
HttpHeaders responseHeaders = new HttpHeaders();
if (user != null) {
user.setLastPasswordResetDate(new Date());
user.setTokenPassword(UUID.randomUUID().toString());
user = urepo.save(user);
SimpleMailMessage passwordResetEmail = new SimpleMailMessage();
passwordResetEmail.setFrom(SENDFROM);
passwordResetEmail.setTo(user.getEmail());
passwordResetEmail.setSubject("Password Reset Request");
passwordResetEmail.setText("Reset link:\n" + BASE_URL + "/reset/" + user.getTokenPassword());
mailSender.send(passwordResetEmail);
return ResponseEntity.ok().headers(responseHeaders).body(user);
}
return ResponseEntity.badRequest().headers(responseHeaders).body(user);
}
use of org.springframework.mail.SimpleMailMessage in project code-chill by CodeChillAlluna.
the class UserController method updateUserEmail.
// method sending a mail to a new user email
public boolean updateUserEmail(String email) {
if (!email.equals("")) {
SimpleMailMessage updateEmail = new SimpleMailMessage();
updateEmail.setFrom(SENDFROM);
updateEmail.setTo(email);
updateEmail.setSubject("Email adresse change");
updateEmail.setText("Your new email adress has been saved by our services");
mailSender.send(updateEmail);
return true;
}
return false;
}
use of org.springframework.mail.SimpleMailMessage in project webofneeds by researchstudio-sat.
the class WonMailSender method sendTextMessage.
public void sendTextMessage(String toEmail, String subject, String text) {
SimpleMailMessage msg = new SimpleMailMessage(this.templateMessage);
msg.setSubject(subject);
msg.setTo(toEmail);
msg.setText(text);
try {
mailSender.send(msg);
} catch (MailException ex) {
logger.warn(ex.getMessage());
}
}
Aggregations