Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
TAM
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
EIP
Labrador
TAM
Merge requests
!248
Add Instantaneous Email Notifications
Code
Review changes
Check out branch
Open in Workspace
Download
Patches
Plain diff
Expand sidebar
Merged
Add Instantaneous Email Notifications
66-email-for-things-that-need-to-happen-notifications
into
dev
Overview
17
Commits
9
Pipelines
16
Changes
29
Merged
Add Instantaneous Email Notifications
Timur Oberhuber
requested to merge
66-email-for-things-that-need-to-happen-notifications
into
dev
Jan 8, 2023
Overview
14
Commits
9
Pipelines
16
Changes
29
Description
Adds notification preferences to the profile page:
Adds instantaneous email notifications when:
Application is submitted: (Subject: "Application (CSE1110) Successfully Submitted!")
Position is offered: (Subject: "Action Required: Position (CSE1110) Offered!")
Without Hiring Message:
With Hiring Message:
Application is rejected (also if offered/hired, then rejected): (Subject: "Application (CSE1110) Rejected")
Without Rejection Message:
With Rejection Message:
Declaration is rejected: (Subject: "Declaration (CSE1100) Rejected")
Declaration is approved: (Subject: "Declaration (CSE1100) Approved")
Related Issues
Resolves
#66 (closed)
Checklist
I have added a changelog entry to reflect the significant changes I made.
Edited
Jan 12, 2023
by
Timur Oberhuber
0
0
Merge request reports
Compare
dev
version 6
c64a5436
Jan 23, 2023
version 5
b00f20db
Jan 23, 2023
version 4
6848a61e
Jan 12, 2023
version 3
32ed2ab7
Jan 12, 2023
version 2
087827ce
Jan 8, 2023
version 1
86b8aa24
Jan 8, 2023
dev (base)
and
latest version
latest version
a41b865f
9 commits,
Jan 24, 2023
version 6
c64a5436
8 commits,
Jan 23, 2023
version 5
b00f20db
7 commits,
Jan 23, 2023
version 4
6848a61e
6 commits,
Jan 12, 2023
version 3
32ed2ab7
4 commits,
Jan 12, 2023
version 2
087827ce
3 commits,
Jan 8, 2023
version 1
86b8aa24
2 commits,
Jan 8, 2023
29 files
+
1429
−
47
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
29
src/main/java/nl/tudelft/tam/config/EmailConfig.java
0 → 100644
+
117
−
0
View file @ a41b865f
Edit in single-file editor
Open in Web IDE
/*
* TAM
* Copyright (C) 2021 - Delft University of Technology
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package
nl.tudelft.tam.config
;
import
java.util.Collections
;
import
java.util.Properties
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.mail.javamail.JavaMailSender
;
import
org.springframework.mail.javamail.JavaMailSenderImpl
;
import
org.thymeleaf.TemplateEngine
;
import
org.thymeleaf.spring5.SpringTemplateEngine
;
import
org.thymeleaf.templatemode.TemplateMode
;
import
org.thymeleaf.templateresolver.ClassLoaderTemplateResolver
;
import
org.thymeleaf.templateresolver.ITemplateResolver
;
import
org.thymeleaf.templateresolver.StringTemplateResolver
;
@Configuration
public
class
EmailConfig
{
@Value
(
"${spring.mail.default-encoding}"
)
private
String
defaultEncoding
;
@Value
(
"${spring.mail.host}"
)
private
String
host
;
@Value
(
"${spring.mail.port}"
)
private
int
port
;
@Value
(
"${spring.mail.username}"
)
private
String
username
;
@Value
(
"${spring.mail.password}"
)
private
String
password
;
@Value
(
"${spring.mail.protocol}"
)
private
String
protocol
;
@Value
(
"${spring.mail.properties.mail.smtp.auth}"
)
private
String
auth
;
@Value
(
"${spring.mail.properties.mail.smtp.starttls.enable}"
)
private
String
enableTls
;
@Value
(
"${spring.mail.properties.mail.smtp.ssl.trust}"
)
private
String
trustSsl
;
@Bean
public
JavaMailSender
emailSender
()
{
JavaMailSenderImpl
mailSender
=
new
JavaMailSenderImpl
();
mailSender
.
setDefaultEncoding
(
defaultEncoding
);
mailSender
.
setHost
(
host
);
mailSender
.
setPort
(
port
);
mailSender
.
setUsername
(
username
);
mailSender
.
setPassword
(
password
);
mailSender
.
setProtocol
(
protocol
);
Properties
props
=
mailSender
.
getJavaMailProperties
();
props
.
put
(
"mail.smtp.auth"
,
auth
);
props
.
put
(
"mail.smtp.starttls.enable"
,
enableTls
);
props
.
put
(
"mail.smtp.ssl.trust"
,
trustSsl
);
return
mailSender
;
}
@Bean
public
TemplateEngine
emailTemplateEngine
()
{
final
SpringTemplateEngine
templateEngine
=
new
SpringTemplateEngine
();
templateEngine
.
addTemplateResolver
(
textTemplateResolver
());
templateEngine
.
addTemplateResolver
(
htmlTemplateResolver
());
templateEngine
.
addTemplateResolver
(
stringTemplateResolver
());
return
templateEngine
;
}
private
ITemplateResolver
textTemplateResolver
()
{
final
ClassLoaderTemplateResolver
templateResolver
=
new
ClassLoaderTemplateResolver
();
templateResolver
.
setOrder
(
1
);
templateResolver
.
setResolvablePatterns
(
Collections
.
singleton
(
"text/*"
));
templateResolver
.
setPrefix
(
"/email/"
);
templateResolver
.
setSuffix
(
".txt"
);
templateResolver
.
setTemplateMode
(
TemplateMode
.
TEXT
);
templateResolver
.
setCharacterEncoding
(
"UTF-8"
);
templateResolver
.
setCacheable
(
false
);
return
templateResolver
;
}
private
ITemplateResolver
htmlTemplateResolver
()
{
final
ClassLoaderTemplateResolver
templateResolver
=
new
ClassLoaderTemplateResolver
();
templateResolver
.
setOrder
(
2
);
templateResolver
.
setResolvablePatterns
(
Collections
.
singleton
(
"html/*"
));
templateResolver
.
setPrefix
(
"/email/"
);
templateResolver
.
setSuffix
(
".html"
);
templateResolver
.
setTemplateMode
(
"HTML"
);
templateResolver
.
setCharacterEncoding
(
"UTF-8"
);
templateResolver
.
setCacheable
(
false
);
return
templateResolver
;
}
private
ITemplateResolver
stringTemplateResolver
()
{
final
StringTemplateResolver
templateResolver
=
new
StringTemplateResolver
();
templateResolver
.
setOrder
(
3
);
templateResolver
.
setTemplateMode
(
"HTML"
);
templateResolver
.
setCacheable
(
false
);
return
templateResolver
;
}
}
Loading