class MailSenderAdapter {

    void sendMessage(TemplateMessage message) {
        var addressee = message.getAddressee();
        var addresseeMail = userService.getUserData(addressee).getEmail();

        // create a new mail message, set the subject, text, addressee and send it
        var mailMessage = new SimpleMailMessage();
        mailMessage.setSubject(message.getSubject());
        mailMessage.setText(message.getText());
        mailMessage.setFrom(properties.getFromMail());
        mailMessage.setTo(addresseeMail);

        mailSender.send(mailMessage);

        log.info(String.format("Mail sent to %s!", addresseeMail));
    }

    public  MailSenderAdapter(MessageRepository messageRepository,
                             JavaMailSender mailSender,
                             UserService userService,
                             MailConfigurationProperties properties,
                             Clock clock);

}