[Building Sakai] Contact all users in Sakai

Steve Swinsburg s.swinsburg at lancaster.ac.uk
Tue Mar 24 05:37:13 PDT 2009


Hi Daniel,

Yes sounds like you need both LDAP accounts and the internally created  
extra ones. As for emailing all users, IMO the MOTD tool should be the  
one that does it. It already sends out site-wide announcements, but  
has no direct notification via email. The option to send an email from  
it still exists though, but it does nothing.

It's been reported in this Jira http://bugs.sakaiproject.org/jira/browse/SAK-4559 
  but no resolution as yet.

So you'll need to implement your own mail send system for now, or work  
on improving the MOTD tool which would be great. If you use your own,  
javax.mail is pretty easy to use, I've included a little bit of old  
Java I used to use for sending mail, take from it what you like. It  
was only written for sending one mail at time though, not sure how  
scalable this is. A simple script which does this would be easy to  
knock up.

---
import javax.mail.*;
import javax.mail.internet.*;
import java.net.InetAddress;
import java.util.Properties;

Properties props = System.getProperties();
props.put("mail.smtp.host", smtpServer);
Session mailSession = Session.getInstance(props, null);
Message msg = new MimeMessage(mailSession);
msg.setFrom(new InternetAddress(emailFrom, emailFromName));
msg.setRecipients(Message.RecipientType.TO,  
InternetAddress.parse(emailTo, false));
msg.setSubject(subject);
msg.setText(message);
Transport.send(msg);
---


cheers,
Steve

---
Steve Swinsburg
Portal Systems Developer
Centre for e-Science
Lancaster University
Lancaster
LA1 4YT

email: s.swinsburg at lancaster.ac.uk
phone: +44 (0) 1524 594870







On 24 Mar 2009, at 09:40, Daniel Lind wrote:

> Thanks Steve!
>
> Then I can conclude that we have three different account types on that
> server: guests, internals and externals. I guess the guest  
> classifies as
> an internal account, though. Unfortunately not all users are in the  
> LDAP
> so we have to check the internal accounts as well.
>
> Du you know the name of the tool for contacting all users from the  
> webb
> interface of Sakai? is it a contrib? It would be really great to have
> that functionality on the Sakai in production! I'm sure we will come  
> to
> situations where we have to contact at least all site owners and it
> would be great if we could do it from the web interface.
>
>
> Regards,
> Daniel Lind
>
> ------------------------------------------
> Daniel Lind
> UMDAC, Umeå universitet
> 901 87 Umeå Telefon: +46 90 786 53 12
> Daniel.Lind at umdac.umu.se
> ------------------------------------------
>
>
> Steve Swinsburg skrev:
>> Hi Daniel,
>>
>> There should not be email addresses in the SAKAI_USER_ID_MAP table  
>> but
>> if user accounts were created with the userId as the eid (ie Guest  
>> user
>> accounts from Site Info > Add Participants), then it may appear that
>> way. Those accounts will also have the email listed in the SAKAI_USER
>> table for each user though, so you can rule out SAKAI_USER_ID_MAP  
>> being
>> a source.
>>
>> The SAKAI_PERSON_T table backs a user's Profile, and there is no
>> guarantee they have filled it out. So that discounts that source as  
>> well.
>>
>> The only real source is the SAKAI_USER table and would be the one I
>> would use. However, being run over LDAP introduces another issue. You
>> say that some appear in there and some don't. My bet is that at some
>> point in time, accounts were created in Sakai as well as LDAP or the
>> LDAP configuration flag to create accounts in Sakai based on those in
>> LDAP was turned on. If they are no longer being synchronised then  
>> that
>> configuration may have changed. FYI I leave this turned off so only  
>> the
>> SAKAI_USER_ID_MAP table is populated which links a username from LDAP
>> (jsmith26) to an internal account in Sakai
>> (5fef7a2b-aca6-4c5b-8bd9-ef82ce9a71c4).
>>
>> And yes, email addresses are looked up in the fly from LDAP if you  
>> have
>> it configured that way.
>>
>> If you can reliably say that all users are in LDAP only, then I'd  
>> just
>> run a query against LDAP to find all users you need to contact. Most
>> LDAP schema's have a field for email, it's generally their official
>> email address for an institution so depending on your local policy
>> students might not be kept up to date (ie a user might only check  
>> their
>> Hotmail address, not their official university one)
>>
>> Note also you could use the web services for this (retrieving user  
>> email
>> addresses).
>>
>> As for how I contact users, MOTD puts a message in their user's My
>> Workspace which is prominently displayed. There is a function for  
>> email
>> notification but I have never found that to work. Think I remember
>> seeing a Jira about it not doing a lot.
>>
>> Hope this helps.
>>
>>
>> cheers,
>> Steve
>>
>> ---
>> Steve Swinsburg
>> Portal Systems Developer
>> Centre for e-Science
>> Lancaster University
>> Lancaster
>> LA1 4YT
>>
>> email: s.swinsburg at lancaster.ac.uk
>> phone: +44 (0) 1524 594870
> _______________________________________________
> 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"

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20090324/8b67472a/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2437 bytes
Desc: not available
Url : http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20090324/8b67472a/attachment-0001.bin 


More information about the sakai-dev mailing list