[Building Sakai] EmailService patch

Adrian Fish a.fish at lancaster.ac.uk
Tue Aug 18 08:26:08 PDT 2009


I've finally uploaded a modified and tested version, so I'm happy for 
that to be merged. Seth informed me that Mailtool is on it's way out, so 
I won't bother with a patch for that.  If MailSendeer uses the 
EmailService, then MailSender should work okay with auth'd SMTP also :)

Cheers,

Adrian.

Adrian Fish wrote:
> I have an objection :)
>
> I've just noticed that Mailtool is using mail.debug as the parameter 
> from sakai.properties to switch on JavaMail debugging. I'd like to 
> align BasicEmailService to use the same and submit a fresh patch 
> before you do. I'm testing now, so I won't be long hopefully.
>
> Cheers,
>
> Adrian.
>
> David Horwitz wrote:
>>
>> If there are no objections I will commit this to the trunk kernel 
>> (i.e targeting 2.7)
>>
>>
>> David
>>
>> >>> Adrian Fish <a.fish at lancaster.ac.uk> 8/18/2009 2:40 PM >>>
>> Hi David,
>>
>> I've opened a ticket at http://jira.sakaiproject.org/browse/KNL-253 with
>> a patch for the email service. I see that Javamail 1.4.2 is already
>> specced in the kernel pom and that OneWayHash.java has been modified, so
>> that's good.
>>
>> Mailtool in Sakai trunk also needs patching. I'll try and do that 
>> this week.
>>
>> Cheers,
>>
>> Adrian.
>>
>> David Horwitz wrote:
>> > Hi Adrian,
>> >
>> > Maybe you could log open a k1 ticket and attach a version of the email
>> > service patch? It seems that to be able to support smtp over ssl would
>> > be sensible and as I read your patch ssl is optional?
>> >
>> > That way we can get this into the 1.1 kernel possibly for 2.7 ....
>> >
>> > D
>> >
>> > Adrian Fish wrote:
>> >  >> If you are using smtp.gmail.com as your SMTP server. That's why :)
>> >>
>> >> I'm consulting on a Sakai deployment in a new Indian university and
>> >> they have no intention of setting up their own mail infrastructure.
>> >> They are using GMail for the whole shebang, and they are enforcing 
>> the
>> >> use of TLS.
>> >>
>> >> Cheers,
>> >>
>> >> Adrian.
>> >>
>> >> Stephen Marquard wrote:
>> >>    >>> OK, I can't resist - why would you want to hook up your 
>> Sakai site to
>> >>> GMail ?
>> >>>
>> >>> Cheers
>> >>> Stephen >>> >>>      >>>>>> Adrian Fish <a.fish at lancaster.ac.uk> 
>> 8/12/2009 4:05 PM >>>        >>>>>>            >>> Apologies for the 
>> stream of 'Emailservice patch' emails. Hopefully
>> >>> this will be the last one. I'm persevering with this because maybe
>> >>> somewhere in the world there is a 2.5.x admin who wants to hook 
>> their
>> >>> Sakai up to GMail ...
>> >>>
>> >>> I've attached three patches. One for email, one for mailtool and one
>> >>> for user. To install them, use the patch command from the root of
>> >>> your Sakai source directory:
>> >>>
>> >>> patch -p0 < email.patch
>> >>> patch -p0 < mailtool.patch
>> >>> patch -p0 < user.patch
>> >>>
>> >>> You should then be able, after the judicious setting of some options
>> >>> in sakai.properties and a restart, to use an authenticating SMTP
>> >>> server like GMail, even over SSL! I haven't done a lot of testing of
>> >>> this; it is an emergency patch to a deployment system, but I am
>> >>> confident :)
>> >>>
>> >>> Is anybody aware on an existing JIRA ticket of relevance. I'd 
>> like to
>> >>> attach these patches to something meaningful.
>> >>>
>> >>> Cheers,
>> >>>
>> >>> Adrian.
>> >>>
>> >>> Adrian Fish wrote:
>> >>> >>>      >>>> I've attached a patch for the 2.5.x version of 
>> OneWayHash.java in
>> >>>> user/user-impl. It basically uses StringUtil to trim the outputs of
>> >>>> MimeUtility, as per David's instruction in
>> >>>> http://jira.sakaiproject.org/browse/KNL-239, and cured my strange
>> >>>> problem with internal user accounts getting locked out.
>> >>>>
>> >>>> I'm going to patch MailTool next, as I need to repeat the SSL and
>> >>>> auth process there.
>> >>>>
>> >>>> Cheers,
>> >>>>
>> >>>> Adrian.
>> >>>>
>> >>>> Adrian Fish wrote:
>> >>>>   >>>>        >>>>> I suppose I should add that SSL does not 
>> work with javamail 1.3.1.
>> >>>>> I couldn't get it to work anyway. Hence the need for 1.4.2.
>> >>>>>
>> >>>>> Cheers,
>> >>>>>
>> >>>>> Adrian.
>> >>>>>
>> >>>>> Adrian Fish wrote:
>> >>>>>     >>>>>          >>>>>> Hi David,
>> >>>>>>
>> >>>>>> Ah, okay. That would explain why one of my test logins keeps
>> >>>>>> getting lost :) I've been rebuilding the stack quite frequently
>> >>>>>> recently and just thought that I had damaged the database 
>> somehow.
>> >>>>>> I'll have a play with patching OneWayHasEncode, as you suggested
>> >>>>>> in the ticket.
>> >>>>>>
>> >>>>>> Many, many thanks for pointing that out.
>> >>>>>>
>> >>>>>> Cheers,
>> >>>>>>
>> >>>>>> Adrian.
>> >>>>>>
>> >>>>>> David Horwitz wrote:
>> >>>>>>       >>>>>>            >>>>>>> Hi Adrian,
>> >>>>>>>
>> >>>>>>> You may have problems with the UserDirectory service and
>> >>>>>>> mail-1.4.2 - at
>> >>>>>>> least we had to change code in it to get it to work in the
>> >>>>>>> current trunk
>> >>>>>>> kernel.
>> >>>>>>>
>> >>>>>>> Have a look at:
>> >>>>>>> http://jira.sakaiproject.org/browse/KNL-239 for what had to be
>> >>>>>>> changed
>> >>>>>>> (it had to do with password hashing)
>> >>>>>>>
>> >>>>>>> Also if you update mail you need to update activation.
>> >>>>>>>
>> >>>>>>> D
>> >>>>>>>
>> >>>>>>> Adrian Fish wrote:
>> >>>>>>> >>>>>>>         >>>>>>>              >>>>>>>> Hi All,
>> >>>>>>>>
>> >>>>>>>> I've attached an svn diff file for Sakai 2.5.x's email service.
>> >>>>>>>> This
>> >>>>>>>> patch adds a set of attributes to the BasicEmailService class.
>> >>>>>>>> These are:
>> >>>>>>>>
>> >>>>>>>> m_smtpUser
>> >>>>>>>> m_smtpPassword
>> >>>>>>>> m_smtpUseSSL
>> >>>>>>>> m_smtpDebug
>> >>>>>>>>
>> >>>>>>>> These can be set from sakai.properties, like this:
>> >>>>>>>>
>> >>>>>>>> smtpUser at org.sakaiproject.email.api.EmailService=<SMTP_USER>
>> >>>>>>>> 
>> smtpPassword at org.sakaiproject.email.api.EmailService=<SMTP_PASSWORD>
>> >>>>>>>>
>> >>>>>>>> smtpUseSSL at org.sakaiproject.email.api.EmailService=true
>> >>>>>>>> smtpDebug at org.sakaiproject.email.api.EmailService=true
>> >>>>>>>>
>> >>>>>>>> Two methods in the class have changed, sendMail and 
>> sendToUsers,
>> >>>>>>>> the
>> >>>>>>>> changes involving setting up the Session properties to use
>> >>>>>>>> authentication and perhaps SSL.
>> >>>>>>>>
>> >>>>>>>> To use this patch against 2.5.x you need to remove old 
>> versions of
>> >>>>>>>> mail.jar (in my case it was mail-1.3.1.jar) and make sure that
>> >>>>>>>> 1.4.2
>> >>>>>>>> gets placed in shared by maven.
>> >>>>>>>>
>> >>>>>>>> I've tested this against gmail using authentication and SSL, 
>> and it
>> >>>>>>>> works. What I've not tested is that Digests still work okay, 
>> but
>> >>>>>>>> they
>> >>>>>>>> should as BaseDigestService uses the send, and consequently the
>> >>>>>>>> sendMail method which I've patched.
>> >>>>>>>>
>> >>>>>>>> To apply it, cd into your 2.5.x SAKAI_SRC/email directory, copy
>> >>>>>>>> email.diff in, and run this:
>> >>>>>>>>
>> >>>>>>>> patch -p0 < email.diff
>> >>>>>>>>
>> >>>>>>>> You should hopefully get some output like this:
>> >>>>>>>>
>> >>>>>>>> patching file email-shared-deploy/pom.xml
>> >>>>>>>> patching file email-impl/.classpath
>> >>>>>>>> patching file
>> >>>>>>>> 
>> email-impl/impl/src/java/org/sakaiproject/email/impl/BasicEmailService.java 
>>
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>> patching file email-impl/impl/pom.xml
>> >>>>>>>> patching file email-api/.classpath
>> >>>>>>>> patching file email-api/api/pom.xml
>> >>>>>>>>
>> >>>>>>>> Any problems, drop me a line.
>> >>>>>>>>
>> >>>>>>>> Cheers,
>> >>>>>>>>
>> >>>>>>>> Adrian.
>> >>>>>>>>
>> >>>>>>>> _______________________________________________
>> >>>>>>>> sakai-dev mailing list
>> >>>>>>>> sakai-dev at collab.sakaiproject.org
>> >>>>>>>> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>> >>>>>>>>
>> >>>>>>>> TO UNSUBSCRIBE: send email to
>> >>>>>>>> sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of
>> >>>>>>>> "unsubscribe"
>> >>>>>>>>                >>>>>>>>                >>>>>>>            
>> >>>>>>>              >>>>>> 
>> _______________________________________________
>> >>>>>> sakai-dev mailing list
>> >>>>>> sakai-dev at collab.sakaiproject.org
>> >>>>>> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>> >>>>>>
>> >>>>>> TO UNSUBSCRIBE: send email to
>> >>>>>> sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of
>> >>>>>> "unsubscribe"
>> >>>>>>        >>>>>>            >>>> 
>> _______________________________________________
>> >>>> sakai-dev mailing list
>> >>>> sakai-dev at collab.sakaiproject.org
>> >>>> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>> >>>>
>> >>>> TO UNSUBSCRIBE: send email to
>> >>>> sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of
>> >>>> "unsubscribe"
>> >>>>    >>>>        >>>  >>>      >> 
>> _______________________________________________
>> >> sakai-dev mailing list
>> >> sakai-dev at collab.sakaiproject.org
>> >> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>> >>
>> >> TO UNSUBSCRIBE: send email to 
>> sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of 
>> "unsubscribe"
>> >>   
>> -- 
>> ==================================
>> Adrian Fish
>> Software Engineer
>> Centre for e-Science
>> Bowland Tower South C Floor
>> Lancaster University
>> Lancaster
>> LA1 4YW
>> email: a.fish at lancaster.ac.uk
>>
>> http://confluence.sakaiproject.org/display/YAFT/Yaft
>> http://confluence.sakaiproject.org/display/BLOG/Home
>> http://confluence.sakaiproject.org/display/AGORA/Home
>>
>
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>
> TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of "unsubscribe"

-- 
==================================
Adrian Fish
Software Engineer
Centre for e-Science
Bowland Tower South C Floor
Lancaster University
Lancaster
LA1 4YW
email: a.fish at lancaster.ac.uk

http://confluence.sakaiproject.org/display/YAFT/Yaft
http://confluence.sakaiproject.org/display/BLOG/Home
http://confluence.sakaiproject.org/display/AGORA/Home

-------------- next part --------------
A non-text attachment was scrubbed...
Name: a_fish.vcf
Type: text/x-vcard
Size: 289 bytes
Desc: not available
Url : http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20090818/ecb40539/attachment.vcf 


More information about the sakai-dev mailing list