Skip to content
This repository was archived by the owner on Jan 2, 2024. It is now read-only.

Commit f21bdf9

Browse files
authored
Update notification email content (#199)
1 parent d86795e commit f21bdf9

File tree

3 files changed

+202
-35
lines changed

3 files changed

+202
-35
lines changed

src/main/java/org/sefglobal/scholarx/service/EmailService.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public EmailService(EmailUtil emailUtil) {
1717
this.emailUtil = emailUtil;
1818
}
1919

20-
public Email sendEmail(String emailAddress, String subject, String message) throws IOException, MessagingException {
20+
public Email sendEmail(String emailAddress, String subject, String message, boolean showButton) throws IOException, MessagingException {
2121
Email email = new Email();
2222
email.setEmail(emailAddress);
2323
email.setSubject(subject);
@@ -27,6 +27,7 @@ public Email sendEmail(String emailAddress, String subject, String message) thro
2727
model.put("emailAddress", emailAddress);
2828
model.put("subject", subject);
2929
model.put("message", message);
30+
model.put("showButton", showButton);
3031
email.setProps(model);
3132

3233
emailUtil.sendSimpleMessage(email);

src/main/java/org/sefglobal/scholarx/util/ProgramUtil.java

Lines changed: 58 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.sefglobal.scholarx.util;
22

3+
import org.apache.commons.lang.StringUtils;
34
import org.sefglobal.scholarx.model.Mentee;
45
import org.sefglobal.scholarx.model.Mentor;
56
import org.sefglobal.scholarx.model.Program;
@@ -30,35 +31,85 @@ public void sendMenteeApplicationEmails(long id, Optional<Program> program) thro
3031

3132
String message;
3233
for (Mentor mentor : mentors) {
33-
message = "You have been " + mentor.getState().name().toLowerCase();
34-
emailService.sendEmail(mentor.getProfile().getEmail(), program.get().getTitle(), message);
34+
35+
if (mentor.getState().name().equals("APPROVED")) {
36+
37+
message = "Dear " + mentor.getProfile().getFirstName() + ",<br /><br />" +
38+
"<b>Congratulations!</b><br />You have been selected by the " +
39+
"ScholarX committee to be a mentor of the " + program.get().getTitle() +
40+
" program. We will soon open up the program for students to " +
41+
"apply and keep you posted on the progress via email. Until " +
42+
"then, read more about student experience " +
43+
"<a href=\"https://medium.com/search?q=scholarx\">here</a> and reach out to us via " +
44+
"<a href=\"mailto:[email protected]\">[email protected]</a> " +
45+
"for any clarifications.";
46+
47+
emailService.sendEmail(mentor.getProfile().getEmail(), StringUtils.capitalize(mentor.getState().name()), message, false);
48+
49+
} else if (mentor.getState().name().equals("REJECTED")) {
50+
51+
message = "Dear " + mentor.getProfile().getFirstName() + ",<br /><br />" +
52+
"Thank you very much for taking your time to apply for the " + program.get().getTitle() + " program. " +
53+
"However, due to the competitive nature of the mentor applications, your application " +
54+
"did not make it to the final list of mentors for the program. We encourage you to try " +
55+
"again next year and follow us on our social media channels for future programs. " +
56+
"If you have any clarifications, please reach out to us via " +
57+
"<a href=\"mailto:[email protected]\">[email protected]</a>";
58+
59+
emailService.sendEmail(mentor.getProfile().getEmail(), StringUtils.capitalize(mentor.getState().name()), message, false);
60+
61+
}
3562
}
3663
}
3764

3865
public void sendMenteeSelectionEmails(long id, Optional<Program> program) throws IOException, MessagingException {
3966
List<Mentor> approvedMentors = mentorRepository.findAllByProgramIdAndState(id, EnrolmentState.APPROVED);
67+
List<Mentee> mentees = menteeRepository.findAllByProgramId(id);
4068

41-
String message = "You can approve or reject your mentees by visiting the dashboard";
69+
// Notify mentors
4270
for (Mentor mentor : approvedMentors) {
43-
emailService.sendEmail(mentor.getProfile().getEmail(), program.get().getTitle(), message);
71+
72+
String message = "Dear " + mentor.getProfile().getFirstName() + ",<br /><br />" +
73+
"You have student applications waiting to be reviewed. You can approve or reject your mentees " +
74+
"by visiting the <b>ScholarX dashboard.</b>";
75+
76+
emailService.sendEmail(mentor.getProfile().getEmail(), program.get().getTitle(), message, true);
77+
}
78+
79+
// Notify mentees
80+
for (Mentee mentee : mentees) {
81+
String message = "Dear " + mentee.getProfile().getFirstName() + ",<br /><br />" +
82+
"Thank you very much for applying to the " + program.get().getTitle() + " program. Your application has been received. " +
83+
"Mentors will soon review your applications and we will keep you posted on the progress via email. " +
84+
"Until then, read more about student experience <a href=\"https://medium.com/search?q=scholarx\">here</a> and reach out to us via " +
85+
"<a href=\"mailto:[email protected]\">[email protected]</a> " +
86+
"for any clarifications.";
87+
88+
emailService.sendEmail(mentee.getProfile().getEmail(), program.get().getTitle(), message, false);
4489
}
4590
}
4691

4792
public void sendOnGoingEmails(long id, Optional<Program> program) throws IOException, MessagingException {
4893
List<Mentor> approvedMentors = mentorRepository.findAllByProgramIdAndState(id, EnrolmentState.APPROVED);
4994

50-
String message = "You can check your mentees by visiting the dashboard";
5195
for (Mentor mentor : approvedMentors) {
52-
emailService.sendEmail(mentor.getProfile().getEmail(), program.get().getTitle(), message);
96+
97+
String message = "Dear " + mentor.getProfile().getFirstName() + ",<br /><br />" +
98+
"<b>Congratulations!</b><br />Students have accepted you as their mentor. " +
99+
"You can check your mentees and their contact details by visiting the <b>ScholarX dashboard.</b> " +
100+
"Please make the first contact with them as we have instructed them to wait for your email.";
101+
102+
emailService.sendEmail(mentor.getProfile().getEmail(), program.get().getTitle(), message, true);
53103
}
54104
}
55105

56106
public void sendMentorConfirmationEmails(long id, Optional<Program> program) throws IOException, MessagingException {
57107
List<Mentee> mentees = menteeRepository.findAllByProgramId(id);
58108

59109
String message = "You can check your mentor by visiting the dashboard";
110+
60111
for (Mentee mentee : mentees) {
61-
emailService.sendEmail(mentee.getProfile().getEmail(), program.get().getTitle(), message);
112+
emailService.sendEmail(mentee.getProfile().getEmail(), program.get().getTitle(), message, true);
62113
}
63114
}
64115
}
Lines changed: 142 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,181 @@
1-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
1+
<!DOCTYPE html
2+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
33
<html xmlns:th="http://www.thymeleaf.org" xmlns="http://www.w3.org/1999/xhtml">
4+
45
<head>
56
<title>ScholarX email template</title>
67
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
78
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
8-
<link href='http://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'/>
9+
<link href="http://fonts.googleapis.com/css?family=Roboto" rel="stylesheet" type="text/css"/>
910

1011
<style>
1112
body {
12-
font-family: 'Roboto', sans-serif;
13+
font-family: "Roboto", sans-serif;
1314
font-size: 48px;
1415
}
15-
table, td, div, h1, p {
16+
17+
table,
18+
td,
19+
div,
20+
h1,
21+
p {
1622
font-family: Arial, sans-serif;
1723
}
24+
1825
@media screen and (max-width: 530px) {
1926
.col-lge {
2027
max-width: 100% !important;
2128
}
2229
}
30+
2331
@media screen and (min-width: 531px) {
2432
.col-sml {
2533
max-width: 27% !important;
2634
}
35+
2736
.col-lge {
2837
max-width: 73% !important;
2938
}
3039
}
3140
</style>
3241
</head>
33-
<body style="margin:0;padding:0;word-spacing:normal;background-color:#ffffff;">
34-
<div role="article" aria-roledescription="email" lang="en" style="text-size-adjust:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;background-color:#ffffff;">
35-
<table role="presentation" style="width:100%;border:none;border-spacing:0;">
42+
43+
<body style="
44+
margin: 0;
45+
padding: 0;
46+
word-spacing: normal;
47+
background-color: #ffffff;
48+
">
49+
<div role="article" aria-roledescription="email" lang="en" style="
50+
text-size-adjust: 100%;
51+
-webkit-text-size-adjust: 100%;
52+
-ms-text-size-adjust: 100%;
53+
background-color: #ffffff;
54+
">
55+
<table role="presentation" style="width: 100%; border: none; border-spacing: 0">
3656
<tr>
37-
<td align="center" style="padding:0;">
38-
<table role="presentation" style="width:94%;max-width:600px;border:none;border-spacing:0;text-align:left;font-family:Arial,sans-serif;font-size:16px;line-height:22px;color:#363636;">
57+
<td align="center" style="padding: 0">
58+
<table role="presentation" style="
59+
width: 94%;
60+
max-width: 600px;
61+
border: none;
62+
border-spacing: 0;
63+
text-align: left;
64+
font-family: Arial, sans-serif;
65+
font-size: 16px;
66+
line-height: 22px;
67+
color: #363636;
68+
">
3969
<tr>
40-
<td style="padding:40px 30px 30px 30px;text-align:center;font-size:24px;font-weight:bold;">
41-
<a href="https://sefglobal.org/" style="text-decoration:none;"><img src="https://sefglobal.org/assets/img/brand/logo.png" width="165" style="width:80%;max-width:165px;height:auto;border:none;text-decoration:none;color:#ffffff;"></a>
70+
<td style="
71+
padding: 40px 30px 30px 30px;
72+
text-align: center;
73+
font-size: 24px;
74+
font-weight: bold;
75+
">
76+
<a href="https://sefglobal.org/" style="text-decoration: none"><img
77+
src="https://sefglobal.org/assets/img/brand/logo.png" width="165" style="
78+
width: 80%;
79+
max-width: 165px;
80+
height: auto;
81+
border: none;
82+
text-decoration: none;
83+
color: #ffffff;
84+
"/></a>
4285
</td>
4386
</tr>
4487
<tr>
45-
<td style="padding:35px 30px 11px 30px;font-size:0;background-color:#ffffff;border-bottom:1px solid #f0f0f5;border-color:rgba(201,201,207,.35);">
88+
<td style="
89+
padding: 35px 30px 11px 30px;
90+
font-size: 0;
91+
background-color: #ffffff;
92+
border-bottom: 1px solid #f0f0f5;
93+
border-color: rgba(201, 201, 207, 0.35);
94+
">
95+
<div class="col-lge" style="
96+
display: inline-block;
97+
width: 100%;
98+
min-width: 100%;
99+
vertical-align: top;
100+
padding-bottom: 20px;
101+
font-family: Arial, sans-serif;
102+
font-size: 16px;
103+
line-height: 22px;
104+
color: #363636;
105+
">
106+
<p style="margin-top: 0; margin-bottom: 22px" th:utext="${message}">
46107

47-
<div class="col-sml" style="display:inline-block;width:100%;max-width:145px;vertical-align:top;text-align:left;font-family:Arial,sans-serif;font-size:14px;color:#363636;">
48-
<img src="https://assets.codepen.io/210284/icon.png" width="115" style="width:80%;max-width:115px;margin-bottom:20px;">
49-
</div>
50-
51-
<div class="col-lge" style="display:inline-block;width:100%;max-width:395px;vertical-align:top;padding-bottom:20px;font-family:Arial,sans-serif;font-size:16px;line-height:22px;color:#363636;">
52-
<p th:text="${message}" style="margin-top:0;margin-bottom:18px;"></p>
53-
<p style="margin:0;"><a href="http://sef-scholarx.herokuapp.com/home" style="background: #ff3884; text-decoration: none; padding: 10px 25px; color: #ffffff; border-radius: 4px; display:inline-block; mso-padding-alt:0;text-underline-color:#ff3884">
54-
<span style="mso-text-raise:10pt;font-weight:bold;">View Dashboard</span>
55-
</a></p>
108+
</p>
109+
<p style="margin-top: 0; margin-bottom: 18px">
110+
Best regards,<br/>
111+
Dharana Jayawardane,<br/>
112+
Program Manager, <br/>
113+
ScholarX,<br/>
114+
Sustainable Education Foundation
115+
</p>
116+
<p style="margin: 0" th:if="${showButton}">
117+
<a href="http://sef-scholarx.herokuapp.com/home" style="
118+
background: #1890ff;
119+
text-decoration: none;
120+
padding: 10px 25px;
121+
color: #ffffff;
122+
border-radius: 4px;
123+
display: inline-block;
124+
mso-padding-alt: 0;
125+
text-underline-color: #1890ff;
126+
">
127+
<span style="mso-text-raise: 10pt; font-weight: bold">View Dashboard</span>
128+
</a>
129+
</p>
56130
</div>
57131
</td>
58132
</tr>
59133
<tr>
60-
<td style="padding:30px;text-align:center;font-size:12px;background-color:#404040;color:#cccccc;">
61-
<p style="margin:0 0 8px 0;">
62-
<a href="https://www.facebook.com/sustainableeducationfoundation" style="text-decoration:none;"><img src="https://assets.codepen.io/210284/facebook_1.png" width="40" height="40" alt="f" style="display:inline-block;color:#cccccc;"></a>
63-
<a href="https://twitter.com/goasksef" style="text-decoration:none;"><img src="https://assets.codepen.io/210284/twitter_1.png" width="40" height="40" alt="t" style="display:inline-block;color:#cccccc;"></a>
134+
<td style="
135+
padding: 30px;
136+
text-align: center;
137+
font-size: 12px;
138+
background-color: #f0f2f5;
139+
color: #cccccc;
140+
">
141+
<p style="margin: 0 0 8px 0">
142+
<a href="https://www.facebook.com/sustainableeducationfoundation"
143+
style="text-decoration: none">
144+
<img
145+
src="https://img.icons8.com/material-outlined/192/000000/facebook-f.png"
146+
alt="facebook-icon"
147+
height="40"
148+
width="40"
149+
style="display: inline-block; opacity: 0.35;">
150+
</a>
151+
<a href="https://twitter.com/goasksef" style="text-decoration: none">
152+
<img
153+
src="https://img.icons8.com/ios-filled/150/000000/twitter.png"
154+
alt="facebook-icon"
155+
height="35"
156+
width="35"
157+
style="display: inline-block; opacity: 0.35;">
158+
</a>
159+
<a href="https://www.linkedin.com/company/sefglobal/" style="text-decoration: none">
160+
<img
161+
src="https://img.icons8.com/windows/128/000000/linkedin-2.png"
162+
alt="facebook-icon"
163+
height="40"
164+
width="40"
165+
style="display: inline-block; opacity: 0.35;">
166+
</a>
167+
<a href="https://www.instagram.com/sefglobal/" style="text-decoration: none">
168+
<img
169+
src="https://img.icons8.com/material-outlined/192/000000/instagram-new--v1.png"
170+
alt="facebook-icon"
171+
height="40"
172+
width="40"
173+
style="display: inline-block; opacity: 0.35;">
174+
</a>
175+
</p>
176+
<p style="margin: 0; font-size: 14px; line-height: 20px">
177+
&copy; Sustainable Education Foundation - SEF 2021
64178
</p>
65-
<p style="margin:0;font-size:14px;line-height:20px;">&copy; Sustainable Education Foundation - SEF 2021</p>
66179
</td>
67180
</tr>
68181
</table>
@@ -71,4 +184,6 @@
71184
</table>
72185
</div>
73186
</body>
187+
74188
</html>
189+

0 commit comments

Comments
 (0)