public MimeMessage waitForEmail() {
		ensureStarted();
		try {
			if (!greenMail.waitForIncomingEmail(1)) {
				throw new IllegalStateException("No email received");
			}
			return greenMail.getReceivedMessages()[0];
		}
		catch (InterruptedException e) {
			throw new IllegalStateException("Interrupted while waiting for an email");
		}
	}
A fixture to help test the {@code mail} sink module. Allows retrieval of emails sent to the configured server.

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