Skip to content

Commit

Permalink
Fix for cherry-pick that went wrong
Browse files Browse the repository at this point in the history
  • Loading branch information
oharsta committed Jan 23, 2025
1 parent 8af00bd commit 3b7dde4
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions myconext-server/src/main/java/myconext/mail/MailBox.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.mustachejava.DefaultMustacheFactory;
import com.github.mustachejava.MustacheFactory;
import jakarta.mail.internet.MimeMessage;
import lombok.SneakyThrows;
import myconext.model.ControlCode;
import myconext.model.EmailsSend;
import myconext.model.User;
import myconext.model.UserLogin;
Expand All @@ -20,6 +18,8 @@
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.util.StringUtils;

import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;
import java.io.*;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
Expand Down Expand Up @@ -184,14 +184,6 @@ public void sendVerificationCode(User user, String verificationCode) {
sendMail("verification_code", title, variables, preferredLanguage(user), user.getEmail(), true);
}

public void sendServiceDeskControlCode(User user, ControlCode controlCode) {
String title = this.getTitle("service_desk_control_code", user);
Map<String, Object> variables = variables(user, title);
variables.put("mySurfConextURL", mySURFconextURL);
variables.put("controlCode", controlCode);
sendMail("service_desk_control_code", title, variables, preferredLanguage(user), user.getEmail(), true);
}

private Map<String, Object> variables(User user, String title) {
Map<String, Object> variables = new HashMap<>();
variables.put("title", title);
Expand Down Expand Up @@ -223,12 +215,12 @@ private void sendMail(String templateName, String subject, Map<String, Object> v
helper.setFrom(emailFrom);
doSendMail(mimeMessage);
} catch (Exception e) {
LOG.error("Error sending mail to "+to, e);
LOG.error("Error sending mail to " + to, e);
//We don't want to stop batch mailings
}
}

protected void setText(String html, String text, MimeMessageHelper helper) throws jakarta.mail.MessagingException {
protected void setText(String html, String text, MimeMessageHelper helper) throws MessagingException {
helper.setText(text, html);
}

Expand Down

0 comments on commit 3b7dde4

Please sign in to comment.