Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
LaMartin-Webomagic
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Deep Dey
LaMartin-Webomagic
Commits
4e0d6c3a
Commit
4e0d6c3a
authored
Aug 05, 2024
by
Deep Dey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add principal email on admission interview email
parent
8b581342
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
4 deletions
+24
-4
lamartinBackend/src/main/java/com/example/LaMartin/admission/dao/controller/AdmissionFormDAOController.java
.../admission/dao/controller/AdmissionFormDAOController.java
+12
-4
lamartinBackend/src/main/java/com/example/LaMartin/common/service/EmailService.java
...ava/com/example/LaMartin/common/service/EmailService.java
+12
-0
No files found.
lamartinBackend/src/main/java/com/example/LaMartin/admission/dao/controller/AdmissionFormDAOController.java
View file @
4e0d6c3a
...
@@ -16,6 +16,7 @@ import org.springframework.stereotype.Controller;
...
@@ -16,6 +16,7 @@ import org.springframework.stereotype.Controller;
import
java.io.ByteArrayInputStream
;
import
java.io.ByteArrayInputStream
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Objects
;
@Controller
@Controller
@AllArgsConstructor
(
onConstructor_
=
@__
({
@Autowired
}))
@AllArgsConstructor
(
onConstructor_
=
@__
({
@Autowired
}))
...
@@ -162,9 +163,16 @@ public class AdmissionFormDAOController {
...
@@ -162,9 +163,16 @@ public class AdmissionFormDAOController {
ByteArrayInputStream
pdfStream
=
pdfService
.
convertHtmlToPdf
(
emailBody
);
ByteArrayInputStream
pdfStream
=
pdfService
.
convertHtmlToPdf
(
emailBody
);
// TODO: also add the principal email here
String
principalEmail
=
"secretariat_lmb@lamartiniere.co"
;
if
(!
Objects
.
equals
(
data
.
getSchool
(),
"La Martiniere for Boys"
))
{
principalEmail
=
"lmgkolkata@gmail.com"
;
}
String
[]
recipients
=
{
data
.
getFatherEmail
(),
principalEmail
};
this
.
emailService
.
sendHtmlEmail
(
this
.
emailService
.
sendHtmlEmail
(
data
.
getFatherEmail
()
,
recipients
,
"ADMISSION APPOINTMENT | "
+
data
.
getSchool
().
toUpperCase
(),
"ADMISSION APPOINTMENT | "
+
data
.
getSchool
().
toUpperCase
(),
emailBody
,
emailBody
,
pdfStream
pdfStream
...
...
lamartinBackend/src/main/java/com/example/LaMartin/common/service/EmailService.java
View file @
4e0d6c3a
...
@@ -40,4 +40,16 @@ public class EmailService {
...
@@ -40,4 +40,16 @@ public class EmailService {
mailSender
.
send
(
message
);
mailSender
.
send
(
message
);
}
}
public
void
sendHtmlEmail
(
String
[]
to
,
String
subject
,
String
htmlBody
,
ByteArrayInputStream
attachment
)
throws
MessagingException
,
IOException
{
MimeMessage
message
=
mailSender
.
createMimeMessage
();
MimeMessageHelper
helper
=
new
MimeMessageHelper
(
message
,
true
);
helper
.
setSubject
(
subject
);
helper
.
setTo
(
to
);
helper
.
setText
(
htmlBody
,
true
);
// true indicates HTML
ByteArrayDataSource
dataSource
=
new
ByteArrayDataSource
(
attachment
,
"application/pdf"
);
helper
.
addAttachment
(
"interaction.pdf"
,
dataSource
);
mailSender
.
send
(
message
);
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment