Commit a552fdf3 authored by Deep Dey's avatar Deep Dey

feat: add bcc emails for interview and admission

parent 3235a0d5
......@@ -136,8 +136,24 @@ public class AdmissionFormDAOController {
ByteArrayInputStream pdfStream = pdfService.convertHtmlToPdf(emailBody);
String[] bcc = {
"paritoshcanning@yahoo.co.in",
"secretary@lamartiniere.co",
"lmcao@lamartiniere.co",
"secretariat_lmb@lamartiniere.co"
};
if (!data.getSchool().equals("La Martiniere for Boys")) {
bcc = new String[]{
"paritoshcanning@yahoo.co.in",
"secretary@lamartiniere.co",
"lmcao@lamartiniere.co",
"lmgkolkata@gmail.com"
};
}
this.emailService.sendHtmlEmail(
data.getFatherEmail(),
bcc,
"SCHEDULED INTERVIEW | " + data.getSchool().toUpperCase(),
emailBody,
pdfStream
......@@ -163,16 +179,25 @@ public class AdmissionFormDAOController {
ByteArrayInputStream pdfStream = pdfService.convertHtmlToPdf(emailBody);
String principalEmail = "secretariat_lmb@lamartiniere.co";
String[] bcc = {
"paritoshcanning@yahoo.co.in",
"secretary@lamartiniere.co",
"lmcao@lamartiniere.co",
"secretariat_lmb@lamartiniere.co"
};
if (!Objects.equals(data.getSchool(), "La Martiniere for Boys")) {
principalEmail = "lmgkolkata@gmail.com";
if (!data.getSchool().equals("La Martiniere for Boys")) {
bcc = new String[]{
"paritoshcanning@yahoo.co.in",
"secretary@lamartiniere.co",
"lmcao@lamartiniere.co",
"lmgkolkata@gmail.com"
};
}
String[] recipients = {data.getFatherEmail(), principalEmail};
this.emailService.sendHtmlEmail(
recipients,
data.getFatherEmail(),
bcc,
"ADMISSION APPOINTMENT | " + data.getSchool().toUpperCase(),
emailBody,
pdfStream
......
......@@ -40,11 +40,12 @@ public class EmailService {
mailSender.send(message);
}
public void sendHtmlEmail(String[] to, String subject, String htmlBody, ByteArrayInputStream attachment) throws MessagingException, IOException {
public void sendHtmlEmail(String to, String[] bcc, 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.setBcc(bcc);
helper.setText(htmlBody, true); // true indicates HTML
ByteArrayDataSource dataSource = new ByteArrayDataSource(attachment, "application/pdf");
helper.addAttachment("interaction.pdf", dataSource);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment