use of org.pmiops.workbench.exceptions.EmailException in project workbench by all-of-us.
the class ProfileController method requestInvitationKey.
@Override
public ResponseEntity<Void> requestInvitationKey(String email) {
Properties props = new Properties();
Session session = Session.getDefaultInstance(props, null);
try {
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress("all-of-us-workbench-eng@googlegroups.com"));
InternetAddress[] replyTo = new InternetAddress[1];
replyTo[0] = new InternetAddress(email);
msg.setReplyTo(replyTo);
// To test the bug reporting functionality, change the recipient email to your email rather
// than the group.
// https://precisionmedicineinitiative.atlassian.net/browse/RW-40
msg.addRecipient(Message.RecipientType.TO, new InternetAddress("all-of-us-workbench-eng@googlegroups.com", "AofU Workbench Engineers"));
msg.setSubject("[AofU Invitation Key Request]");
msg.setText(email + " is requesting the invitation key.");
Transport.send(msg);
} catch (MessagingException | UnsupportedEncodingException e) {
throw new EmailException("Error sending invitation key request", e);
}
return ResponseEntity.status(HttpStatus.NO_CONTENT).build();
}
use of org.pmiops.workbench.exceptions.EmailException in project workbench by all-of-us.
the class BugReportController method sendBugReport.
@Override
public ResponseEntity<BugReport> sendBugReport(BugReport bugReport) {
Properties props = new Properties();
Session session = Session.getDefaultInstance(props, null);
try {
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress("all-of-us-workbench-eng@googlegroups.com"));
InternetAddress[] replyTo = new InternetAddress[1];
replyTo[0] = new InternetAddress(bugReport.getContactEmail());
msg.setReplyTo(replyTo);
// To test the bug reporting functionality, change the recipient email to your email rather
// than the group.
// https://precisionmedicineinitiative.atlassian.net/browse/RW-40
msg.addRecipient(Message.RecipientType.TO, new InternetAddress("all-of-us-workbench-eng@googlegroups.com", "AofU Workbench Engineers"));
msg.setSubject("[AofU Bug Report]: " + bugReport.getShortDescription());
msg.setText(bugReport.getReproSteps());
Transport.send(msg);
} catch (MessagingException e) {
throw new EmailException("Error sending bug report", e);
} catch (UnsupportedEncodingException e) {
throw new EmailException("Error sending bug report", e);
}
return ResponseEntity.ok(bugReport);
}
Aggregations