public void sendEmail(String from, String subject, String msg) {
		ensureStarted();
		JavaMailSenderImpl mailSender = new JavaMailSenderImpl();

		mailSender.setHost("localhost");
		mailSender.setPort(smtpPort);
		mailSender.setProtocol("smtp");


		MimeMessage message = mailSender.createMimeMessage();
		MimeMessageHelper helper = new MimeMessageHelper(message);
		try {
			helper.setTo(ADMIN_USER + "@localhost");
			helper.setFrom(from);
			helper.setSubject(subject);
			helper.setText(msg);
			mailSender.send(message);
		}
		catch (MessagingException e) {
			throw new RuntimeException(e);
		}

	}
Base class support for both "mail" and "imap".

@author Eric Bottard
spring-xd-test-fixtures/src/main/java/org/springframework/xd/test/fixtures/AbstractMailSource.java