I finally got it working. I had to modify the Email.java file like you said,
by adding the following:

To the top:
 import java.security.DigestInputStream;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
 import java.security.Provider;
 import java.security.Security;

Before "Properties props" declaration:
 Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());

After SMTP authentication block:
 props.put("mail.smtp.socketFactory.port", "465");

props.put("mail.smtp.socketFactory.class","javax.net.ssl.SSLSocketFactory");
 props.put("mail.smtp.socketFactory.fallback", "false");

It works fine now, and I am not worrying about the TLS on my own server. 
Thanks for all your help!!




gathub wrote:
> 
> Ok, I will give that a shot. Do you know why the mail server on our own
> server is not working though? It says something about enabling STARTTLS,
> but I'm not sure how I would do that in Tomcat.
> 
> 
> 
> Stuart Lewis wrote:
>> 
>> Hi,
>> 
>> You'll need to change the code slightly (org.dspace.core.Email) to allow
>> it to connect securely to google's mail servers. A web search will
>> probably come up with some working solutions (e.g.
>> http://www.coderanch.com/t/274207/Other-JSE-JEE-APIs/java/Sending-Email-
>> using-Java-mail)
>> 
>> If you come up with a generic solution, please consider submitting it as
>> a patch on JIRA (http://jira.dspace.org/)
>> 
>> Thanks,
>> 
>> 
>> Stuart Lewis
>> Digital Services Programmer
>> Te Tumu Herenga The University of Auckland Library
>> Auckland Mail Centre, Private Bag 92019, Auckland 1142, New Zealand
>> Ph: 64 9 373-7599 x81928
>> http://www.library.auckland.ac.nz/
>> 
>> 
>> 
>> 
>> -----Original Message-----
>> From: gathub [mailto:[email protected]] 
>> Sent: Thursday, 18 June 2009 9:37 a.m.
>> To: [email protected]
>> Subject: [Dspace-devel] Having problem with e-mail system - using Gmail
>> 
>> 
>> I have configured my DSpace to relay my e-mails through Gmail, but I
>> have not
>> been able to get any kind of messages working.  This comes up obviously
>> when
>> trying to register a new user.  My dspace.cfg has "smtp.gmail.com" for
>> the
>> mail.server, and "465" as the port. Here is the error I was originally
>> getting:
>> 
>> javax.mail.MessagingException: Could not connect to SMTP host:
>> smtp.gmail.com, port: 465, response: -1
>>         at
>> com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1270)
>>         at
>> com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370)
>>         at javax.mail.Service.connect(Service.java:297)
>>         at javax.mail.Service.connect(Service.java:156)
>>         at javax.mail.Service.connect(Service.java:105)
>>         at javax.mail.Transport.send0(Transport.java:168)
>>         at javax.mail.Transport.send(Transport.java:98)
>>         at org.dspace.core.Email.send(Email.java:362)
>>         at
>> org.dspace.eperson.AccountManager.sendEmail(AccountManager.java:296)
>>         at
>> org.dspace.eperson.AccountManager.sendInfo(AccountManager.java:256)
>>         at
>> org.dspace.eperson.AccountManager.sendRegistrationInfo(AccountManager.ja
>> va:101)
>>         at
>> org.dspace.app.webui.servlet.RegisterServlet.processEnterEmail(RegisterS
>> ervlet.java:287)
>>         at
>> org.dspace.app.webui.servlet.RegisterServlet.doDSPost(RegisterServlet.ja
>> va:202)
>>         at
>> org.dspace.app.webui.servlet.DSpaceServlet.processRequest(DSpaceServlet.
>> java:147)
>>         at
>> org.dspace.app.webui.servlet.DSpaceServlet.doPost(DSpaceServlet.java:105
>> )
>>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
>>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>>         at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
>> tionFilterChain.java:290)
>>         at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
>> erChain.java:206)
>>         at
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
>> e.java:233)
>>         at
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
>> e.java:191)
>>         at
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
>> :128)
>>         at
>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
>> :102)
>>         at
>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
>> java:109)
>>         at
>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:2
>> 86)
>>         at
>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:84
>> 5)
>>         at
>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(
>> Http11Protocol.java:583)
>>         at
>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
>>         at java.lang.Thread.run(Thread.java:636)
>> 
>> If I try to use the mail server on our own server, this error comes up:
>> 
>> com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a
>> STARTTLS
>> command first. 4sm391195agc.52
>>         at
>> com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1388
>> )
>>         at
>> com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:959)
>>         at
>> com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:583)
>>         at javax.mail.Transport.send0(Transport.java:169)
>>         at javax.mail.Transport.send(Transport.java:98)
>>         at org.dspace.core.Email.send(Email.java:362)
>>         at
>> org.dspace.eperson.AccountManager.sendEmail(AccountManager.java:296)
>>         at
>> org.dspace.eperson.AccountManager.sendInfo(AccountManager.java:256)
>>         at
>> org.dspace.eperson.AccountManager.sendRegistrationInfo(AccountManager.ja
>> va:101)
>>         at
>> org.dspace.app.webui.servlet.RegisterServlet.processEnterEmail(RegisterS
>> ervlet.java:287)
>>         at
>> org.dspace.app.webui.servlet.RegisterServlet.doDSPost(RegisterServlet.ja
>> va:202)
>>         at
>> org.dspace.app.webui.servlet.DSpaceServlet.processRequest(DSpaceServlet.
>> java:147)
>>         at
>> org.dspace.app.webui.servlet.DSpaceServlet.doPost(DSpaceServlet.java:105
>> )
>>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
>>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>>         at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
>> tionFilterChain.java:290)
>>         at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
>> erChain.java:206)
>>         at
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
>> e.java:233)
>>         at
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
>> e.java:191)
>>         at
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
>> :128)
>>         at
>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
>> :102)
>>         at
>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
>> java:109)
>>         at
>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:2
>> 86)
>>         at
>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:84
>> 5)
>>         at
>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(
>> Http11Protocol.java:583)
>>         at
>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
>>         at java.lang.Thread.run(Thread.java:636)
>> 
>> I am very confused at what is happening here, but from I've read, many
>> people have not been able to get Gmail to work with their system.  Could
>> anyone lend me some insight? Thanks
>> -- 
>> View this message in context:
>> http://www.nabble.com/Having-problem-with-e-mail-system---using-Gmail-tp
>> 23968280p23968280.html
>> Sent from the DSpace - Devel mailing list archive at Nabble.com.
>> 
>> 
>> ------------------------------------------------------------------------
>> ------
>> Crystal Reports - New Free Runtime and 30 Day Trial
>> Check out the new simplified licensing option that enables unlimited
>> royalty-free distribution of the report engine for externally facing 
>> server and web deployment.
>> http://p.sf.net/sfu/businessobjects
>> _______________________________________________
>> Dspace-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/dspace-devel
>> 
>> ------------------------------------------------------------------------------
>> Crystal Reports - New Free Runtime and 30 Day Trial
>> Check out the new simplified licensing option that enables unlimited
>> royalty-free distribution of the report engine for externally facing 
>> server and web deployment.
>> http://p.sf.net/sfu/businessobjects
>> _______________________________________________
>> Dspace-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/dspace-devel
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Having-problem-with-e-mail-system---using-Gmail-tp23968280p24095316.html
Sent from the DSpace - Devel mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Dspace-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-devel

Reply via email to