Note that there are some explanatory texts on larger screens.

plurals
  1. POSpring Java Mail gmail smtp not working in Ubuntu
    primarykey
    data
    text
    <p>I am just sending the email to users via gmail account. Everything works fine in my development environment (windows 7), but when i move to production ubuntu , then its throwing the following exception</p> <pre><code>java.lang.RuntimeException: org.springframework.mail.MailAuthenticationException: Authentication failed; nested exception is javax.mail.AuthenticationFailedException at com.product.mailservice.MailServiceImpl.sendMail(MailServiceImpl.java:90) </code></pre> <p>Here is my configuration</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:util="http://www.springframework.org/schema/util" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"&gt; &lt;bean id="javaMailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl"&gt; &lt;property name="password" value="xxxxxxx"&gt;&lt;/property&gt; &lt;property name="username" value="xxxxxx@gmail.com"&gt;&lt;/property&gt; &lt;property name="javaMailProperties"&gt; &lt;props&gt; &lt;prop key="mail.smtp.auth"&gt;true&lt;/prop&gt; &lt;prop key="mail.debug"&gt;false&lt;/prop&gt; &lt;prop key="mail.smtp.host"&gt;smtp.gmail.com&lt;/prop&gt; &lt;prop key="mail.smtp.socketFactory.port"&gt;465&lt;/prop&gt; &lt;prop key="mail.smtp.socketFactory.class"&gt;javax.net.ssl.SSLSocketFactory&lt;/prop&gt; &lt;prop key="mail.smtp.starttls.enable"&gt;true&lt;/prop&gt; &lt;prop key="mail.smtp.port"&gt;465&lt;/prop&gt; &lt;prop key="mail.smtp.user"&gt;xxxxxx@gmail.com&lt;/prop&gt; &lt;prop key="mail.smtp.password"&gt;xxxxxxx&lt;/prop&gt; &lt;prop key="mail.smtp.ssl.enable"&gt;true&lt;/prop&gt; &lt;/props&gt; &lt;/property&gt; &lt;/bean&gt; &lt;bean id="templateMessage" class="org.springframework.mail.SimpleMailMessage"&gt; &lt;property name="from"&gt; &lt;value&gt;xxxxxx@gmail.com&lt;/value&gt; &lt;/property&gt; &lt;property name="subject"&gt; &lt;value&gt;Password Notification&lt;/value&gt; &lt;/property&gt; &lt;/bean&gt; &lt;bean id="mailService" class="com.product.mailservice.MailServiceImpl"&gt; &lt;property name="javaMailSender" ref="javaMailSender" /&gt; &lt;property name="templateMessage" ref="templateMessage" /&gt; &lt;/bean&gt; </code></pre> <p></p> <p>Update. Here is the debug information</p> <p>DEBUG: JavaMail version 1.4ea DEBUG: java.io.FileNotFoundException: C:\Program Files\Java\jdk1.6.0_21\jre\lib\javamail.providers (The system cannot find the file specified) DEBUG: !anyLoaded DEBUG: not loading resource: /META-INF/javamail.providers DEBUG: successfully loaded resource: /META-INF/javamail.default.providers DEBUG: Tables of loaded providers DEBUG: Providers Listed By Class Name: {com.sun.mail.smtp.SMTPSSLTransport=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc], com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc], com.sun.mail.imap.IMAPSSLStore=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc], com.sun.mail.pop3.POP3SSLStore=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun Microsystems, Inc], com.sun.mail.imap.IMAPStore=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc]} DEBUG: Providers Listed By Protocol: {imaps=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc], imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], smtps=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc], pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc], pop3s=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun Microsystems, Inc], smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]} DEBUG: successfully loaded resource: /META-INF/javamail.default.address.map DEBUG: !anyLoaded DEBUG: not loading resource: /META-INF/javamail.address.map DEBUG: java.io.FileNotFoundException: C:\Program Files\Java\jdk1.6.0_21\jre\lib\javamail.address.map (The system cannot find the file specified) DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc] DEBUG SMTP: useEhlo true, useAuth true DEBUG SMTP: trying to connect to host "smtp.gmail.com", port 465, isSSL false</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload