Sorry for flooding this thread.
After i've understood this javamail.address.map magic, i've re-evaluated
the solution. But Romain is still a Hero.
No need for javamail.address.map .
The real solution is to use "mail.smtp.socketFactory.class" property.
Set this to "javax.net.ssl.SSLSocketFactory", and let the transport be
simple smtp. This way you get an smtp transport over ssl connection. And
this is what smtps means. (smtp over ssl)
The right, and working resource for smtps:
<Resource id="mail/trial" type="javax.mail.Session">
mail.transport.protocol=smtp
mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory
mail.smtp.socketFactory.fallback=false
mail.smtp.host=smtp.gmail.com
mail.smtp.port=465
mail.smtp.auth=true
mail.smtp.user=[gmail address]
mail.from=[gmail address]
password=[password]
</Resource>
2013/10/16 Tamás Kimmel <[email protected]>
>
> Thanks!
>
> Added your javamail.address.map magic, and changed "mail.smtps.password"
> in the resource to "password".
> And now it works without any custom password authenticator.
> Pushed<https://github.com/kumm/tomeemailtest/commit/315a2776ef71eb71cef57ecc287cbe2270de07e2>to
> my testapp.
> Tested on 1.5.2, and 1.6.0 snapshot.
>
> Romain is a Hero :)
>
>
> 2013/10/16 Romain Manni-Bucau <[email protected]>
>
>> Hi
>>
>> maybe try to add src/main/resources/META-INF/javamail.address.map with:
>> "rfc822=smtps"
>>
>> Then you surely want to set a password authenticator on the session.
>>
>>
>> *Romain Manni-Bucau*
>> *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
>> *Blog: **http://rmannibucau.wordpress.com/*<
>> http://rmannibucau.wordpress.com/>
>> *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
>> *Github: https://github.com/rmannibucau*
>>
>>
>>
>> 2013/10/16 Tamás Kimmel <[email protected]>
>>
>> > Hi, i'm affected too.
>> >
>> > Tested with last jdk (1.7.0_45), linux, amd64.
>> > Does not work with tomee 1.5.2, and even 1.6.0 snapshot.
>> > You can clone my test project:
>> https://github.com/kumm/tomeemailtest.git
>> > I'm trying to send mail from:
>> >
>> >
>> https://github.com/kumm/tomeemailtest/blob/master/src/main/java/trial/kumm/tomeemailtest/SendServlet.java
>> > in resources.xml i use smtps:
>> >
>> >
>> https://github.com/kumm/tomeemailtest/blob/master/src/main/webapp/WEB-INF/resources.xml
>> >
>> > In the logs i see SMTPTransport used with default valies:
>> > DEBUG: getProvider() returning provider protocol=smtp;
>> > type=javax.mail.Provider$Type@78c36125;
>> > class=org.apache.geronimo.javamail.transport.smtp.SMTPTransport;
>> > vendor=Apache Software Foundation;version=1.0
>> > smtp DEBUG: Attempting plain socket connection to server localhost:25
>> > smtp DEBUG: Received exception -> I/O exception establishing connection
>> > smtp DEBUG: Exception message -> Connection refused
>> > java.net.ConnectException: Connection refused
>> >
>> >
>> >
>> >
>> > 2013/8/2 Romain Manni-Bucau <[email protected]>
>> >
>> > > Hi,
>> > >
>> > > i just tested with last jdk (1.7.0_25) and it works fine
>> > >
>> > >
>> > > *Romain Manni-Bucau*
>> > > *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
>> > > *Blog: **http://rmannibucau.wordpress.com/*<
>> > > http://rmannibucau.wordpress.com/>
>> > > *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
>> > > *Github: https://github.com/rmannibucau*
>> > >
>> > >
>> > >
>> > > 2013/8/1 bibhas <[email protected]>
>> > >
>> > > > I am using geronimo that comes with TomEE.
>> > > >
>> > > > Resource is defined as:
>> > > >
>> > > > <Resource id="mail/Default" type="javax.mail.Session">
>> > > > mail.transport.protocol=smtps
>> > > > mail.smtps.host=smtp.gmail.com
>> > > > mail.smtps.port=465
>> > > > mail.smtps.auth=true
>> > > >
>> > > >
>> > >
>> >
>> mail.smtps.class=org.apache.geronimo.javamail.transport.smtp.SMTPSTransport
>> > > > [email protected]
>> > > > mail.smtps.password=password
>> > > > </Resource>
>> > > >
>> > > >
>> > > > Here is the debug log:
>> > > >
>> > > > Loading javamail.default.providers from
>> > > >
>> > > >
>> > >
>> >
>> jar:file:/home/wasadmin/apache-tomee-jaxrs-1.5.2/lib/geronimo-javamail_1.4_mail-1.8.2.jar!/META-INF/javamail.default.providers
>> > > > DEBUG: loading new provider protocol=smtp,
>> > > > className=org.apache.geronimo.javamail.transport.smtp.SMTPTransport,
>> > > > vendor=Apache Software Foundation, version=1.0
>> > > > DEBUG: loading new provider protocol=smtps,
>> > > >
>> className=org.apache.geronimo.javamail.transport.smtp.SMTPSTransport,
>> > > > vendor=Apache Software Foundation, version=1.0
>> > > > DEBUG: loading new provider protocol=nntp-post,
>> > > > className=org.apache.geronimo.javamail.transport.nntp.NNTPTransport,
>> > > > vendor=Apache Software Foundation, version=1.0
>> > > > DEBUG: loading new provider protocol=nntp-posts,
>> > > >
>> className=org.apache.geronimo.javamail.transport.nntp.NNTPSSLTransport,
>> > > > vendor=Apache Software Foundation, version=1.0
>> > > > DEBUG: loading new provider protocol=nntp,
>> > > > className=org.apache.geronimo.javamail.store.nntp.NNTPStore,
>> > > vendor=Apache
>> > > > Software Foundation, version=1.0
>> > > > DEBUG: loading new provider protocol=nntps,
>> > > > className=org.apache.geronimo.javamail.store.nntp.NNTPSSLStore,
>> > > > vendor=Apache Software Foundation, version=1.0
>> > > > DEBUG: loading new provider protocol=pop3,
>> > > > className=org.apache.geronimo.javamail.store.pop3.POP3Store,
>> > > vendor=Apache
>> > > > Software Foundation, version=1.0
>> > > > DEBUG: loading new provider protocol=pop3s,
>> > > > className=org.apache.geronimo.javamail.store.pop3.POP3SSLStore,
>> > > > vendor=Apache Software Foundation, version=1.0
>> > > > DEBUG: loading new provider protocol=imap,
>> > > > className=org.apache.geronimo.javamail.store.imap.IMAPStore,
>> > > vendor=Apache
>> > > > Software Foundation, version=1.0
>> > > > DEBUG: loading new provider protocol=imaps,
>> > > > className=org.apache.geronimo.javamail.store.imap.IMAPSSLStore,
>> > > > vendor=Apache Software Foundation, version=1.0
>> > > > DEBUG: getProvider() returning provider protocol=smtp;
>> > > > type=javax.mail.Provider$Type@1838e17;
>> > > > class=org.apache.geronimo.javamail.transport.smtp.SMTPTransport;
>> > > > vendor=Apache Software Foundation;version=1.0
>> > > > smtp DEBUG: Attempting plain socket connection to server
>> localhost:25
>> > > > smtp DEBUG: Received exception -> I/O exception establishing
>> connection
>> > > > smtp DEBUG: Exception message -> Connection refused
>> > > > java.net.ConnectException: Connection refused
>> > > > at java.net.PlainSocketImpl.socketConnect(Native Method)
>> > > > at
>> > > >
>> java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.ja
>> > > >
>> > > >
>> > > >
>> > > > --
>> > > > View this message in context:
>> > > >
>> > >
>> >
>> http://openejb.979440.n4.nabble.com/Not-loading-smtps-resource-properly-tp4664442p4664462.html
>> > > > Sent from the OpenEJB User mailing list archive at Nabble.com.
>> > > >
>> > >
>> >
>>
>
>