2013-02-13 3 views
0

Désolé pour la question répétée.Hôte SMTP inconnu: smtp.live.com

Mais je ne comprends pas comment cette erreur à venir ... quand je suis Envoi de courrier (avec Hotmail)

Entendre est mon exemple de code ..

<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl"> 
    <property name="host" value="smtp.live.com" /> 
    <property name="port" value="587" /> 
    <property name="username" value="[email protected]" /> 
    <property name="password" value="**********" /> 

    <property name="javaMailProperties"> 
     <props> 
      <prop key="mail.smtp.auth">true</prop> 
      <prop key="mail.smtp.starttls.enable">true</prop> 
     </props> 
    </property> 
</bean> 

Mais je suis arrivé cette exception ..

org.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.MessagingException: Unknown SMTP host: smtp.live.com; 
    nested exception is: 
    java.net.UnknownHostException: smtp.live.com. Failed messages: javax.mail.MessagingException: Unknown SMTP host: smtp.live.com; 
    nested exception is: 
    java.net.UnknownHostException: smtp.live.com; message exception details (1) are: 
Failed message 1: 
javax.mail.MessagingException: Unknown SMTP host: smtp.live.com; 
    nested exception is: 
    java.net.UnknownHostException: smtp.live.com 
    at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1280) 
    at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370) 
    at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) 
    at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:689) 
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) 
    at org.springframework.flex.core.MessageInterceptionAdvice.invoke(MessageInterceptionAdvice.java:66) 
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) 
    at org.springframework.aop.framework.adapter.ThrowsAdviceInterceptor.invoke(ThrowsAdviceInterceptor.java:124) 
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) 
    at org.springframework.aop.framework.Cglib2AopProxy$FixedChainStaticTargetInterceptor.intercept(Cglib2AopProxy.java:573) 
    at flex.messaging.endpoints.AMFEndpoint$$EnhancerByCGLIB$$ace25600.serviceMessage(<generated>) 
    at flex.messaging.endpoints.amf.MessageBrokerFilter.invoke(MessageBrokerFilter.java:103) 
    at flex.messaging.endpoints.AMFEndpoint$$EnhancerByCGLIB$$ace25600.service(<generated>) 
    at org.springframework.flex.servlet.MessageBrokerHandlerAdapter.handle(MessageBrokerHandlerAdapter.java:109) 
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923) 
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852) 
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882) 
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789) 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:641) 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) 
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) 
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002) 
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585) 
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) 
    at java.lang.Thread.run(Thread.java:662) 
Caused by: java.net.UnknownHostException: smtp.live.com 
+0

Ce n'est pas un problème de JavaMail mais simplement la paresse du questionneur pour trouver le bon nom de domaine SMTP. –

Répondre

1

smtp.live.com est probablement désuète. L'enregistrement MX pour live.com pointe vers mx1.hotmail.com via mx4.hotmail.com; essayez l'un de ceux-là.

2

C'est un peu étrange. L'exception indique que la recherche DNS pour smtp.live.com a échoué. Pourtant, quand je l'ai fait une recherche pour « smtp.live.com » Je suis arrivé ceci:

$ nslookup smtp.live.com 
Server:  10.0.0.138 
Address: 10.0.0.138#53 

Non-authoritative answer: 
smtp.live.com canonical name = smtp.hot.glbdns.microsoft.com. 
Name: smtp.hot.glbdns.microsoft.com 
Address: 65.55.162.200 

Je soupçonne que ce soit vous avez une panne DNS temporaire/local, ou quelque chose ne va pas avec vos configs DNS. Il est également possible que l'entrée DNS soit en cours de retrait ... et vos caches DNS en amont l'ont expiré avant le mien. Essayez de faire une recherche DNS vous-même et dites-nous ce qu'il rapporte. Et si cela échoue, je vous suggère de chercher un hôte SMTP plus à jour pour "live.com"/hotmail/tout ce qu'il appelle lui-même.

0

smtp.live.com devrait fonctionner. Très probablement, vous êtes derrière un pare-feu d'entreprise qui empêche l'accès direct à Internet, donc vous ne pouvez pas rechercher le nom. La FAQ JavaMail a tips for debugging connection problems.

Questions connexes