You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jspwiki.apache.org by Baráti Zoltán <ba...@gmail.com> on 2009/11/21 02:46:04 UTC

JSPWiki 2.8.3 mail LostPassword smtp gmail ssl

Hello All, I built JSPWiki 1.8.3 with the ant  build.xml under jdk 1.6 today
and I wanted to get sending new password workingI've been workin on it since
yesterday afternoon and ... Since it's just a cumputer program I decided to
go to sleep now.
Before that here is some documentation:
Could you help me to solve this?

*in container JSPWiki says:*
DEBUG SMTP: trying to connect to host "smtp.gmail.com", port 465,* isSSL
false*

*while in a normal java App*
getMyCustomMailSessionForGoogleGmail() does it's job and the mail is
sent*with SSL  without an error
*

That's the point I'm stucked.

Anyway I started it today with 2.8.2 and it had quite the same problem

THE DETAILS:
I wrote a util class which I call like this

============================================================================
  public static void sendMessage(WikiEngine engine, String to, String
subject, String content)
        throws AddressException, MessagingException
    {

        Session session = getMyCustomMailSessionForGoogleGmail();

        PrintStream ps = session.getDebugOut();
        session.getProperties().list( ps );
        ps.printf( "we have the session %s\n ", session.toString() );
        log.info("we have the session"+session.toString());

        try
        {
            // Create and address the message
            ps.printf( "1 \n");ps.flush();
            MimeMessage msg = new MimeMessage(session);
            ps.printf( "2 \n");ps.flush();
           msg.addFrom(new InternetAddress[]{new
InternetAddress(MU.from())});
           ps.printf( "3 \n");ps.flush();
           log.info(MU.from()+" expected to send new passwd ");
           ps.printf( "4 \n");ps.flush();
           ps.printf( " %s  expected to send new passwd ",MU.from());
           ps.printf( "5 \n");ps.flush();
           msg.addRecipient(RecipientType.TO, new InternetAddress(to));
           ps.printf( "6 \n");ps.flush();
            msg.setSubject(subject);
            ps.printf( "7 \n");ps.flush();
            msg.setText(content, "UTF-8");
            ps.printf( "8 \n");ps.flush();
            msg.setSentDate(new Date());
            ps.printf( "9 \n");ps.flush();
            // Send and log it
            ps.printf( "10 next we send new passwd ");ps.flush();
            Transport.send(msg);
            //if (log.isInfoEnabled())
            {
                log.info("Sent e-mail to=" + to + ", subject=\"" + subject +
"\"\n ");
                         //+ (c_useJndi ? "JNDI" : "standalone") + " mail
session.");
            }
        }
        catch (MessagingException e)
        {
            log.info(e);
            throw e;
        }
        finally {
            ps.printf(  "EXIT sendMessage \n " );
        }

    }
============================================================================


and the mail debug PrintStream has these:
########################################################-- listing
properties --
mail.smtp.starttls.enable=true
mail.smtp.port=465
mail.smtp.auth=true
mail.smtp.host=smtp.gmail.com
mail.smtp.submitter=baratiza@gmail.com
mail.smtp.ssl.enable=true
we have the session javax.mail.Session@60525c
 1
2
3
4
 baratiza@gmail.com  expected to send new passwd 5
6
7
8
9
10 next we send new passwd DEBUG: getProvider() returning
javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun
Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: trying to connect to host "smtp.gmail.com", port 465, isSSL
false
DEBUG SMTP: EOF: [EOF]
DEBUG SMTP: could not connect to host "smtp.gmail.com", port: 465, response:
-1

EXIT sendMessage


########################################################



Yours, Zolta
JSPWiki at   http://magyarul-tanulunk.brz.hu/

Re: JSPWiki 2.8.3 mail LostPassword smtp gmail ssl

Posted by Florian Holeczek <fl...@holeczek.de>.
Hi Zolta,

> *in container JSPWiki says:*
> DEBUG SMTP: trying to connect to host "smtp.gmail.com", port 465,* isSSL
> false*

what do you mean by "in container"? ... Could it be that you are getting
your Mail session via JNDI? In that case, the settings in
jspwiki.properties wouldn't apply, of course. Please have a look at the
jspwiki.log. AFAIR it logs some mail info during application startup.

Regards
 Florian