// the following does work, but may break in a later version
// (there is some confusion in the greenmail code about
// whether users are identified by email or name alone)
// in which case try retrieving by EMAIL rather than USER
logger.debug("Creating mail user " + user + "/" + email + "/" + password);
UserManager userManager = servers.getManagers().getUserManager();
userManager.createUser(email, user, password);
GreenMailUser target = userManager.getUser(user);
if (null == target)
{
throw new IllegalStateException("Failure in greenmail - see comments in test code.");
}
target.deliver((MimeMessage) message);