public class EmailService {
@Autowired
private JavaMailSender sender;
@Autowired
private Configuration config;
public ICUser sendEmail(ICUser user, Map<String, Object> model) {
MimeMessage message = sender.createMimeMessage();
try {
MimeMessageHelper helper = new MimeMessageHelper(message, MimeMessageHelper.MULTIPART_MODE_MIXED_RELATED,
StandardCharsets.UTF_8.name());
Template t = config.getTemplate("email-template.ftl");
String html = FreeMarkerTemplateUtils.processTemplateIntoString(t, model);
helper.setTo(user.getEmail());
helper.setText(html, true);
helper.setSubject("OnClick Info Team");
helper.setFrom("syedazar016@gmail.com");
sender.send(message);
}
}