<commit_before>package ch.uzh.csg.reimbursement.mail;

import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

import javax.mail.internet.MimeMessage;

import org.apache.velocity.app.VelocityEngine;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.MailSender;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.mail.javamail.MimeMessagePreparator;
import org.springframework.stereotype.Service;
import org.springframework.ui.velocity.VelocityEngineUtils;

import ch.uzh.csg.reimbursement.model.Role;
import ch.uzh.csg.reimbursement.model.User;

@Service
public class SimpleEmailService {

	@Autowired
	private JavaMailSender mailSender;

	@Autowired
	private VelocityEngine velocityEngine;

	public void setMailSender(JavaMailSender mailSender) {
		this.mailSender = mailSender;
	}

	public void setVelocityEngine(VelocityEngine velocityEngine) {
		this.velocityEngine = velocityEngine;
	}

	public void sendEmail() {
		sendConfirmationEmail();
	}

	private void sendConfirmationEmail() {
		MimeMessagePreparator preparator = new MimeMessagePreparator() {
			public void prepare(MimeMessage mimeMessage) throws Exception {
				MimeMessageHelper message = new MimeMessageHelper(mimeMessage);
//				message.setTo("<EMAIL>");
//				message.setCc("<EMAIL>");
				message.setTo("<EMAIL>");
				message.setFrom("<EMAIL>");
				message.setSubject("[reimbursement] New expense item");
				
				Map<String, Object> model = new HashMap<String, Object>();
				model.put("firstname", "Sebastian");
				model.put("lastname", "Schrepfer");
				
				String text = VelocityEngineUtils.mergeTemplateIntoString(velocityEngine, "ch/uzh/csg/reimbursement/mail/email-template.vm", "utf-8", model);
				message.setText(text, true);
			}
		};
		this.mailSender.send(preparator);
	}

}<commit_msg>CTRL + SHIFT + O, @crixx<commit_after>package ch.uzh.csg.reimbursement.mail;

import java.util.HashMap;
import java.util.Map;

import javax.mail.internet.MimeMessage;

import org.apache.velocity.app.VelocityEngine;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.mail.javamail.MimeMessagePreparator;
import org.springframework.stereotype.Service;
import org.springframework.ui.velocity.VelocityEngineUtils;

@Service
public class SimpleEmailService {

	@Autowired
	private JavaMailSender mailSender;

	@Autowired
	private VelocityEngine velocityEngine;

	public void setMailSender(JavaMailSender mailSender) {
		this.mailSender = mailSender;
	}

	public void setVelocityEngine(VelocityEngine velocityEngine) {
		this.velocityEngine = velocityEngine;
	}

	public void sendEmail() {
		sendConfirmationEmail();
	}

	private void sendConfirmationEmail() {
		MimeMessagePreparator preparator = new MimeMessagePreparator() {
			@Override
			public void prepare(MimeMessage mimeMessage) throws Exception {
				MimeMessageHelper message = new MimeMessageHelper(mimeMessage);
				//				message.setTo("<EMAIL>");
				//				message.setCc("<EMAIL>");
				message.setTo("<EMAIL>");
				message.setFrom("<EMAIL>");
				message.setSubject("[reimbursement] New expense item");

				Map<String, Object> model = new HashMap<String, Object>();
				model.put("firstname", "Sebastian");
				model.put("lastname", "Schrepfer");

				String text = VelocityEngineUtils.mergeTemplateIntoString(velocityEngine, "ch/uzh/csg/reimbursement/mail/email-template.vm", "utf-8", model);
				message.setText(text, true);
			}
		};
		this.mailSender.send(preparator);
	}

}
{'fraction_non_alphanumeric': 0.11384854771784232, 'fraction_numerical': 0.0005186721991701245, 'mean_word_length': 5.482352941176471, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6000598', 'n_tokens_mistral': 1305, 'n_tokens_neox': 1190, 'n_words': 208}