AnsweredAssumed Answered

Email Configuration - Microsoft exchange problem

Question asked by alessioa. on Nov 24, 2006
Latest reply on Dec 12, 2006 by amitsinghrathore
Hi to all the folks,
i have problem sending e-mail from my firm with Alfreco….
I configure it with these values:

mail.host=smtp.innovianet.it
mail.port=25
mail.username=user@innovianet.it
mail.password=***************
# Set this value to UTF-8 or similar for encoding of email messages as required
mail.encoding=UTF-8
# Set this value to 7bit or similar for Asian encoding of email headers as required
mail.header=

and receive this error:

14:58:18,437 ERROR [org.alfresco.web.bean.TemplateMailHelperBean] Failed to send email to test@innovianet.it
org.springframework.mail.MailSendException: Could not send mails: 454 5.7.3 Client does not have permission to submit mail to this server.

com.sun.mail.smtp.SMTPSendFailedException: 454 5.7.3 Client does not have permission to submit mail to this server.

   at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1275)
   at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:895)
   at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:524)
   at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:382)
   at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:326)
   at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:341)
   at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:330)
   at org.alfresco.web.bean.TemplateMailHelperBean.notifyUser(TemplateMailHelperBean.java:142)
   at org.alfresco.web.bean.wizard.InviteUsersWizard.finish(InviteUsersWizard.java:226)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:129)
   at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
   at javax.faces.component.UICommand.broadcast(UICommand.java:106)
   at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:90)
   at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:164)
   at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:316)
   at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
   at javax.faces.webapp.FacesServlet.service(FacesServlet.java:105)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.alfresco.web.app.servlet.AuthenticationFilter.doFilter(AuthenticationFilter.java:73)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
   at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
   at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
   at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
   at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
   at java.lang.Thread.run(Thread.java:595)

I create a my class for sending e-mail, this is the code:

import javax.mail.*;
import java.util.*;
import javax.mail.internet.*;


public class invioMail_JavaMail {
 
 
  public static void javamaildemo() {
    try {
      String host = "smtp.innovianet.it"; //smtp
      String from = "user@innovianet.it"; //indirizzo email
      String ToAddress = "test@innovianet.it"; //destinatario
      String user = "user";
      String pass = "************";
      //initialize the StringBuffer object within the try/catch loop
      StringBuffer sb = new StringBuffer( );
     
      //Get system properties
      Properties props = System.getProperties();
   
      //Setup mail server
      props.setProperty("mail.smtp.host", host);
      props.setProperty("mail.debug", "true");
      props.setProperty("mail.smtp.auth","true");

      //Get session
      Session session = Session.getDefaultInstance(props, null);
      session.setDebug(true);
      session.setPasswordAuthentication(new URLName("smtp",host,25,"INBOX",user,pass), new PasswordAuthentication(user,pass));

      //Define message
      MimeMessage msg = new MimeMessage(session);
      //Set the from address
      msg.setFrom(new InternetAddress(from));
      //Set the to address
      msg.addRecipient(Message.RecipientType.TO, new InternetAddress(ToAddress));
      //Set the subject
      msg.setSubject("Test mail using JavaMail APIs");
      //Set the text content for body
      sb.append("This is the 1st String line.\n\n");
      sb.append("This is the 2nd String line.\n\n");
      sb.append("This is the 3rd String line.\n\n");
      msg.setText(sb.toString( )); 
      //Send message
      Transport tr = session.getTransport("smtp");
      tr.connect(host, user, pass);
      msg.saveChanges(); // don't forget this
      tr.sendMessage(msg, msg.getAllRecipients());
      tr.close();
    }
    catch (MessagingException e) {
      System.out.println(e);
    }
  }
 
  public static void main(String[] args) {
    javamaildemo();
  }
}

And this code works …
Our SMTP have the anonymous access blocked, could be this the problem?
If so there is an alfresco property to set? how can solve the problem?

Thank you very much…
I spent on it two days but not able to solve the problem…

Alessio A.

Outcomes