I need add new users in Apache James mail server using Java API, but in the whole internet there is not any example of how to use it. Only this http://james.apache.org/server/2.3.1/adding_users.html with Java mail API you can send mail to Apache James mailbox read messages, but only that.
String user = "user"; // Newly created user on JAMES
String password = "user"; // user password
String fromAddress = "user@localhost"; // newlycreateduser@localhost
String toAddress = "usver@gmail.com";
// Create a mail session
Properties properties = new Properties();
properties.put("mail.smtp.host", "localhost");
properties.put("mail.smtp.port", "25");
properties.put("mail.smtp.username", user);
properties.put("mail.smtp.password", password);
Session session = Session.getDefaultInstance(properties, null);
try
{
Message message = new MimeMessage(session);
message.setFrom(new InternetAddress(fromAddress));
message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(toAddress));
message.setSubject("Email from our JAMES Server");
message.setText("Hello world again and again");
Transport.send(message);
System.out.println("Email sent successfully");
}
catch (MessagingException e)
{
e.printStackTrace();
}
Anybody know or used James Java API? Any examples?