Organizational Research By

Surprising Reserch Topic

improve performance on sending bulk emails through spring mail


improve performance on sending bulk emails through spring mail  using -'java,spring,performance,email,bulk'

I have a spring-stand alone application which uses  simple spring email code as below , the to and the message is constructed using the values iterated from map.

I have already had some suggestions for the question here , but i am in need of some specific advise for this. below is my code

for (Map.Entry<String, List<values>> entry : testMap
                .entrySet()) {
            String key = entry.getKey();
            StringBuilder htmlBuilder = new StringBuilder();            
            List<Model> valueList = entry.getValue();
            for (Model value : valueList) {
                htmlBuilder.append('List Values in the message');
            }
            mail.sendMail( msgFrom,body); // call my sendMail function in another class
        }


Code for sending mail :

        MimeMessage email = mailSender.createMimeMessage();
        MimeMessageHelper helper = new MimeMessageHelper(email, true);
        helper.setFrom(new InternetAddress(from));
        helper.setTo(new InternetAddress(to));
        helper.setText(msg, true);
        helper.addInline("identifier1234", res);
        mailSender.send(email);


It takes 3 to 4 seconds to send mail . I have large user list of around 400,000 each day to be sent

Am i doing anything wrong or anyother approach to fasten this process. I am in need of experts advise

Thanks for your time and help :)
    
asked Oct 13, 2015 by vijaygupta1980
0 votes
10 views



Related Hot Questions



Government Jobs Opening


...