Announcement Announcement Module
Collapse
No announcement yet.
mail and authentication Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • mail and authentication

    Hi,
    I would like to try sending email in the Spring way. but got error:

    org.springframework.mail.MailAuthenticationExcepti on: Authentication failed: null; nested exception is javax.mail.AuthenticationFailedException: null.

    I am testing yahoo email which enables smtp authentication. Saw one posting here for configuring authenticated mail sender and tried but failed with the above error message. not sure whatelse I need to do:

    <bean id="mailSender" class="org.springframework.mail.javamail.JavaMailS enderImpl">
    <property name="host"><value>smtp.mail.yahoo.com</value></property>
    <property name="port"><value>587</value></property>
    <property name="username"><value>myname</value></property>
    <property name="password"><value>mypassword</value></property>
    <property name="javaMailProperties">
    <props>
    <prop key="mail.smtp.auth">true</prop>
    </props>
    </property>
    </bean>


    Here is code for sending a testing email:

    SimpleMailMessage msg = new SimpleMailMessage();
    msg.setTo("myemail address");
    msg.setText("testing email");
    msg.setSubject("email from myself");
    msg.setFrom("myemail address");
    try{
    mailSender.send(msg);
    } catch(MailException ex) {
    ....
    }


    thanks !
    li xin
Working...
X