0

I'm new in scala. I'm using apache-james-3.0, Scala in my project. I want to send notify message as no-reply@myservicename.com to external email. James has a postmaster (http://james.apache.org/server/3/config-mailetcontainer.html). My problem is i don't know how to read postmaster user from mailetcontainer.conf file further i need to set to field a from(message.setFrom).

My Code:

val properties = new Properties();
val host = "mylocalserver.com";         
properties.put("mail.smtp.host", host);
properties.setProperty("mail.transport.protocol", "smtp"); 
properties.put("mail.smtp.auth", "true"); 
properties.setProperty("mail.user", "login@login.com"); 
properties.setProperty("mail.password", "psw"); 
val emailSession = Session.getDefaultInstance(properties);
val emailMessage = new MimeMessage(emailSession);
emailMessage.addRecipient(Message.RecipientType.TO, new InternetAddress("login1@login1.com"));
emailMessage.addRecipient(Message.RecipientType.CC, new InternetAddress("login2@login2.com"));
emailMessage.setFrom(new InternetAddress("postmaster@mylocalserver.com"));
emailMessage.setSubject("subject sd sd sdsd");
emailMessage.setText("body vodiy text text");
emailSession.setDebug(true);
Transport.send(emailMessage)

How do i reach it? Please help me, explain me! Thanks in advance!

Bob
  • 1,351
  • 11
  • 28
  • Don't know about apache, but i was making mail-sending module with a help of [this](http://blog.eigengo.com/blog_posts/akka-extras-email) post – 4lex1v Jul 29 '13 at 07:46
  • It's good, but My goal is sending email without PasswordAuthentication. – Bob Jul 29 '13 at 07:59

0 Answers0