0

I am using Velocity enguine and java mailing service to send mails. i am using SMTP protocal.. here are my configurations for that

bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl"/

            property name="host" value="lotus.acme.com"/            
        property name="port" value="25"/
        property name="username" value="edosrvc"/
        property name="password" value="wipro@123"/
        property name="javaMailProperties"
            props
                <!-- Use SMTP transport protocol -->
                prop key="mail.transport.protocol">smtp</prop>
                <!-- Use SMTP-AUTH to authenticate to SMTP server -->
                <prop key="mail.smtp.auth">true</prop>
                  <prop key="mail.smtp.ssl.trust">*</prop> 

                <!-- Use TLS to encrypt communication with SMTP server -->
                <prop key="mail.smtp.starttls.enable">true</prop>
                <prop key="mail.debug">true</prop>
            </props>
        </property>
   </bean>

   <bean id="esi" class="com.example.NotificationServiceImpl">      
        <property name="mailSender" ref="mailSender" />
        <property name="velocityEngine" ref="velocityEngine" />     
   </bean>

   <bean id="velocityEngine"class="org.springframework.ui.velocity.VelocityEngineFactoryBean">        
 <property name="velocityProperties">
                       <value>
                   resource.loader=class
                    class.resource.loader.class=org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
                </value>
                    </property>             
    </bean>

    <bean id="templateMessage" class="org.springframework.mail.SimpleMailMessage">
        <property name="from" value="samplesrvc@acme.com"></property>

    </bean>

i have tried including this property also

*

even then i am getting the belo error

sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:174) at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:238) at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:280) at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:191) at sun.security.validator.Validator.validate(Validator.java:218)

can anyone please help me on this issue.

I am very new to these protocals and server certificates.

so any one can please tell me how to get my work done soon.

Thanks in advance.

raki
  • 195
  • 1
  • 10

1 Answers1

0

What version of JavaMail are you using?

If you turn on Session debugging, what does the debugging output show?

Also, try setting the System property "mail.socket.debug" to "true" for additional debugging output related to certificates.

I don't know anything about Velocity so I have no idea how those property settings in your code are getting to JavaMail, but it seems quite possible that they aren't, which would explain the problem. The debugging output will help verify what's really going on.

Bill Shannon
  • 29,579
  • 6
  • 38
  • 40