I'm using version 1.3.3 Apache Commons Mail for sending out emails. I've tried
but still the mail is not sending out.
this is the debug message i had, googled for solution, but none that solve the problem i have
DEBUG: JavaMail version 1.4ea
DEBUG: java.io.FileNotFoundException: C:\Program Files\Java\jdk1.7.0_67\jre\lib\javamail.providers (The system cannot find the file specified)
DEBUG: URL jar:file:/C:/Users/doreenlohjw/.m2/repository/org/jvnet/mock- javamail/mock-javamail/1.9/mock-javamail-1.9.jar!/META-INF/javamail.providers
DEBUG: Bad provider entry:
DEBUG: successfully loaded resource: jar:file:/C:/Users/doreenlohjw/.m2/repository/org/jvnet/mock-javamail/mock- javamail/1.9/mock-javamail-1.9.jar!/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], org.jvnet.mock_javamail.MockStore=javax.mail.Provider[STORE,imap,org.jvnet.mock_javamail.MockStore,java.net mock-javamail project], com.sun.mail.pop3.POP3SSLStore=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun Microsystems, Inc], org.jvnet.mock_javamail.MockTransport=javax.mail.Provider[TRANSPORT,smtp,org.jvnet.mock_javamail.MockTransport,java.net mock-javamail project], 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,org.jvnet.mock_javamail.MockStore,java.net mock-javamail project], smtps=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc], pop3=javax.mail.Provider[STORE,pop3,org.jvnet.mock_javamail.MockStore,java.net mock-javamail project], pop3s=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun Microsystems, Inc], smtp=javax.mail.Provider[TRANSPORT,smtp,org.jvnet.mock_javamail.MockTransport,java.net mock-javamail project]}
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.7.0_67\jre\lib\javamail.address.map (The system cannot find the file specified)
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,org.jvnet.mock_javamail.MockTransport,java.net mock-javamail project]
and my code as of below,
MultiPartEmail email = new MultiPartEmail();
email.setSmtpPort(587);
email.setHostName("smtp.gmail.com");
email.setAuthentication("xxx@gmail.com", "xxx");
email.setDebug(true);
email.setStartTLSEnabled(true);
email.setFrom(from);
email.setSubject(subject);
email.setMsg(msg);
email.addTo(to);
email.attach(attachment);
email.send();
It seems you have a mailing mock service in your classpath. Guessing from the name I'd guess that this implementation won't send out a real mail.
So please try to remove that library from the classpath and try again.
I you use maven, you can set the scope
of that mock dependency to test
.