[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [Classpathx-javamail] GNU JavaMail CRAM-MD5 Support
From: |
Jos Collin-ERS,HCLTech |
Subject: |
RE: [Classpathx-javamail] GNU JavaMail CRAM-MD5 Support |
Date: |
Tue, 5 Oct 2010 13:31:05 +0530 |
Thanks Chris for the information.
So you mean, I have to set the property mail.smtp.auth.mechanisms as
props.put("mail.smtp.auth.mechanisms", "CRAM-MD5"). The following is my code
where I set the properties. Also, do I have to do anything additional, as the
CRAM-MD5 authentication is different from PLAIN? How does it receive the
challenge from the server and send the digest back?
Thanks,
Jos Collin
-----------------------
//Create a Properties object and set the properties
Properties props = new Properties();
props.put("mail.transport.protocol", "smtp");
props.put("mail.smtp.host", SMTP_HOST_NAME);
props.put("mail.smtp.port", SMTP_HOST_PORT);
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.ssl.enable", "true");
//Authenticator can be used only by creating a child class
Authenticator auth = new SMTPAuthenticator();
// Create a session using the authenticator object
Session mailSession = Session.getDefaultInstance(props, auth);
Transport transport = mailSession.getTransport();
________________________________________
From: Chris Burdess address@hidden
Sent: Tuesday, October 05, 2010 1:17 PM
To: address@hidden
Cc: Jos Collin-ERS,HCLTech
Subject: Re: [Classpathx-javamail] GNU JavaMail CRAM-MD5 Support
Jos Collin-ERS,HCLTech wrote:
> I'm using GNU JavaMail in my program. I'm using a PLAIN SMTP Authentication
> right now. But my SMTP server is configured to use CRAM-MD5. So I want to
> know whether GNU JavaMail supports CRAM-MD5 authentication for SMTP.
Yes it does.
If for some reason it keeps falling back to PLAIN, it may be that the server is
presenting the authentication mechanisms in the "wrong" order. You can override
the order in which authentication mechanisms are attempted by the client by
setting the mail.smtp.auth.mechanisms session property (e.g.
"mail.smtp.auth.mechanisms=CRAM-MD5,PLAIN,LOGIN"), see the SMTP provider
package JavaDoc for more information.
--
Chris Burdess
DISCLAIMER:
-----------------------------------------------------------------------------------------------------------------------
The contents of this e-mail and any attachment(s) are confidential and intended
for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its affiliates.
Any views or opinions presented in
this email are solely those of the author and may not necessarily reflect the
opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification,
distribution and / or publication of
this message without the prior written consent of the author of this e-mail is
strictly prohibited. If you have
received this email in error please delete it and notify the sender
immediately. Before opening any mail and
attachments please check them for viruses and defect.
-----------------------------------------------------------------------------------------------------------------------