Project

General

Profile

« Previous | Next » 

Revision 55378

[Trunk|AdminTools]: EmailController: change contact method to send an email to all recipients

View differences:

modules/uoa-admin-tools/src/main/java/eu/dnetlib/uoaadmintools/controllers/EmailController.java
30 30
    private VerifyRecaptcha verifyRecaptcha;
31 31

  
32 32
    @RequestMapping(value = "/contact", method = RequestMethod.POST)
33
    public Map<String, ArrayList<String>> contact(@RequestBody EmailRecaptcha form) {
33
    public Boolean contact(@RequestBody EmailRecaptcha form) {
34 34
        try {
35 35
            verifyRecaptcha.processResponse(form.getRecaptcha());
36
            return sendEmail(form.getEmail(), Optional.of(false));
36
            Email email = form.getEmail();
37
            ArrayList<String> sendTo = new ArrayList<>();
38
            for(String userMail: email.getRecipients()){
39
                sendTo.add(userMail);
40
            }
41
            return emailSender.send(sendTo, email.getSubject(), email.getBody(), false);
37 42
        } catch (InvalidReCaptchaException e) {
38 43
            return null;
39 44
        }

Also available in: Unified diff