<commit_before>package edu.emory.cci.aiw.cvrg.eureka.services.email;

import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

/**
 * Send emails to users when a notable event regarding the user occurs in the
 * system.
 * 
 * @author hrathod
 * 
 */
public class EmailSenderImpl implements EmailSender {
	/**
	 * The email session to be used to send the email.
	 */
	private final Session session;

	/**
	 * The default constructor.
	 * 
	 * @throws NamingException
	 */
	public EmailSenderImpl() throws NamingException {
		final Context initCtx = new InitialContext();
		final Context envCtx = (Context) initCtx.lookup("java:comp/env");
		this.session = (Session) envCtx.lookup("mail/Session");
	}

	/* (non-Javadoc)
	 * @see edu.emory.cci.aiw.cvrg.eureka.services.email.EmailSenderIF#sendMessage(java.lang.String)
	 */
	@Override
	public void sendMessage(final String user) throws MessagingException {
		MimeMessage message = new MimeMessage(this.session);
		// message subject
		message.setSubject("Eureka TESTING!");
		// message body
		message.setContent("Hi, you have registered with Eureka!", "text/plain");
		message.addRecipient(Message.RecipientType.TO,
				new InternetAddress(user));
		Transport.send(message);
	}

}<commit_msg>Updated to match changes in the EmailSender interface.<commit_after>package edu.emory.cci.aiw.cvrg.eureka.services.email;

import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

import edu.emory.cci.aiw.cvrg.eureka.common.entity.User;

/**
 * Send emails to users when a notable event regarding the user occurs in the
 * system.
 * 
 * @author hrathod
 * 
 */
public class EmailSenderImpl implements EmailSender {
	/**
	 * The email session to be used to send the email.
	 */
	private final Session session;

	/**
	 * The default constructor.
	 * 
	 * @throws NamingException
	 */
	public EmailSenderImpl() throws NamingException {
		final Context initCtx = new InitialContext();
		final Context envCtx = (Context) initCtx.lookup("java:comp/env");
		this.session = (Session) envCtx.lookup("mail/Session");
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * edu.emory.cci.aiw.cvrg.eureka.services.email.EmailSenderIF#sendMessage
	 * (java.lang.String)
	 */
	@Override
	public void sendMessage(final User user) throws EmailException {
		try {
			MimeMessage message = new MimeMessage(this.session);
			// message subject
			message.setSubject("Eureka TESTING!");
			// message body
			message.setContent("Hi, you have registered with Eureka!",
					"text/plain");
			message.addRecipient(Message.RecipientType.TO, new InternetAddress(
					user.getEmail()));
			Transport.send(message);
		} catch (MessagingException me) {
			throw new EmailException(me);
		}
	}

}
{'fraction_non_alphanumeric': 0.11433926897844424, 'fraction_numerical': 0.0, 'mean_word_length': 4.292561983471074, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6082742', 'n_tokens_mistral': 1061, 'n_tokens_neox': 977, 'n_words': 238}