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 { ...@@ -136,8 +136,24 @@ public class AdmissionFormDAOController {
ByteArrayInputStream pdfStream = pdfService.convertHtmlToPdf(emailBody); 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( this.emailService.sendHtmlEmail(
data.getFatherEmail(), data.getFatherEmail(),
bcc,
"SCHEDULED INTERVIEW | " + data.getSchool().toUpperCase(), "SCHEDULED INTERVIEW | " + data.getSchool().toUpperCase(),
emailBody, emailBody,
pdfStream pdfStream
...@@ -163,16 +179,25 @@ public class AdmissionFormDAOController { ...@@ -163,16 +179,25 @@ public class AdmissionFormDAOController {
ByteArrayInputStream pdfStream = pdfService.convertHtmlToPdf(emailBody); ByteArrayInputStream pdfStream = pdfService.convertHtmlToPdf(emailBody);
String principalEmail = "secretariat_lmb@lamartiniere.co"; String[] bcc = {
"paritoshcanning@yahoo.co.in",
if (!Objects.equals(data.getSchool(), "La Martiniere for Boys")) { "secretary@lamartiniere.co",
principalEmail = "lmgkolkata@gmail.com"; "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"
};
} }
String[] recipients = {data.getFatherEmail(), principalEmail};
this.emailService.sendHtmlEmail( this.emailService.sendHtmlEmail(
recipients, data.getFatherEmail(),
bcc,
"ADMISSION APPOINTMENT | " + data.getSchool().toUpperCase(), "ADMISSION APPOINTMENT | " + data.getSchool().toUpperCase(),
emailBody, emailBody,
pdfStream pdfStream
......
...@@ -40,11 +40,12 @@ public class EmailService { ...@@ -40,11 +40,12 @@ public class EmailService {
mailSender.send(message); 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(); MimeMessage message = mailSender.createMimeMessage();
MimeMessageHelper helper = new MimeMessageHelper(message, true); MimeMessageHelper helper = new MimeMessageHelper(message, true);
helper.setSubject(subject); helper.setSubject(subject);
helper.setTo(to); helper.setTo(to);
helper.setBcc(bcc);
helper.setText(htmlBody, true); // true indicates HTML helper.setText(htmlBody, true); // true indicates HTML
ByteArrayDataSource dataSource = new ByteArrayDataSource(attachment, "application/pdf"); ByteArrayDataSource dataSource = new ByteArrayDataSource(attachment, "application/pdf");
helper.addAttachment("interaction.pdf", dataSource); 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