Warning: Can't synchronize with repository "(default)" (/home/git/ome.git does not appear to be a Git repository.). Look in the Trac log for more information.
Notice: In order to edit this ticket you need to be either: a Product Owner, The owner or the reporter of the ticket, or, in case of a Task not yet assigned, a team_member"

User Story #11768 (closed)

Opened 10 years ago

Closed 9 years ago

Add customisable server email capabilities

Reported by: drussell-x Owned by: atarkowska
Priority: major Milestone: 5.1.0
Component: Services Keywords: n.a.
Cc: ux@…, web-team@…, jballanco-x Story Points: n.a.
Sprint: n.a. Importance: n.a.
Total Remaining Time: n.a. Estimated Remaining Time: n.a.

Description

In order to facilitate sending announcement (and potentially other) emails from the OMERO server instance the sendEmail method or whatever the new method is called will need to accept several parameters:

This would send a message with the defined subject and message. I currently have no need to send email with CCs or recipients, but I think it would make sense to add support for this initially in case someone wishes to use it. Thus it is possible to specify a list of experimenters and groups. It also accepts a list of strings of arbitrary email addresses. This is useful for CCing a departmental mailing list or similar. This is especially important in an LDAP environment as the server is accessible to new users at any time so they'd need to know about a service disruption up-front etc.

// Sends a single message to a collection of experimenters resolved from the Experimenter
// and ExperimenterGroup lists.
boolean sendEmail(
    boolean all,
    List<Experimenter> experimentersTo,
    List<ExperimenterGroup> groupsTo,
    List<String> cc,
    String subject,
    String message
)

// Sends a message many times, individually (standard automated email procedure)
boolean sendMassEmail(
    boolean all,
    List<Experimenter> experimentersTo,
    List<ExperimenterGroup> groupsTo,
    List<String> additionalRecipients,
    String subject,
    String message
)

I'm undecided what the return types should be. All success/fail is one option. What about a partial failure? What about a failure to resolve a specified user as they don't have an email address, should that fail silently?

It might also be nice to have the capability for an admin to check if the server
has the capability to send emails. Obviously it can't really check if the emails
are correctly being sent, but just that the settings are present in the server
to enable it to send email.

boolean isEmailEnabled()

Some of the required functionality can be recoded in Java from here. I think group resolution to email lists is probably the missing piece there.

Cheers,

Douglas

Change History (20)

comment:1 Changed 10 years ago by jburel

  • Cc ux@… added

comment:2 Changed 10 years ago by drussell-x

Just wondering if there is any progress on this so I can then update my emailing utility to use it and then file a PR for that. Thanks.

comment:3 Changed 10 years ago by jamoore

  • Cc web-team@… added

As discussed in devteam, there hasn't been any progress on moving this behind the IAdmin (or similar) interface yet.

Douglas opened his implementation as a PR: https://github.com/openmicroscopy/openmicroscopy/pull/2127

If it's merged, then the API changes should likely also be moved from "unscheduled" to "5.1.0*".

Will / Ola: room for discussion of webadmin extension points?

comment:4 Changed 10 years ago by atarkowska

  • Component changed from General to Services
  • Milestone changed from Unscheduled to 5.1.0
  • Owner set to atarkowska
  • Priority changed from minor to major

comment:5 Changed 10 years ago by atarkowska

We already have that functionality hidden on the server side in sendEmail. My intention is to evaluate existing sendEmail method and move it to the new interface called IEmail.

comment:6 Changed 10 years ago by jamoore

Ola, what all do you see being in IEmail? If the number of methods is fairly small, it'd likely be better to do this via the omero.cmd-style invocation, because that way we also get status updates ("Sending emails: 25% done") for free.

comment:7 Changed 10 years ago by atarkowska

Here is a list of methods

 // ~ Email
    // =========================================================================

    /**
     * Send email to every users.
     */
    boolean sendEmailToAllUsers(List<String> cc, String subject, String message);
    
    /**
     * Send email to active users.
     */
    boolean sendEmailToActiveUsers(List<String> cc, String subject, String message);
    
    /**
     * Send email to inactive users.
     */
    boolean sendEmailToInactiveUsers(List<String> cc, String subject, String message);
    
    /**
     * Send email to the given users.
     */
    boolean sendEmailToUsers(List<Experimenter> exps, List<String> cc, String subject, String message);
    
    /**
     * Send email to users in the given groups.
     */
    boolean sendEmailToGroups(List<ExperimenterGroup> groups, List<String> cc, String subject, String message);
    

I am still thinking about mass email

Last edited 10 years ago by atarkowska (previous) (diff)

comment:8 Changed 10 years ago by atarkowska

Douglas any comments?

comment:9 Changed 10 years ago by jamoore

  • Cc jballanco-x added

After discussing briefly with Ola the possibility of using a omero.cmd-style service, I'd propose something like:

class Message {
  LongList userIds; // or by name?
  LongList groupIds; // ditto?
  StringSet cc;
};

class TextMessage {
  string subject;
  string body;
};

class SendEmail extends Request {
    Message msg;
};

Questions:

  • Any need to support mime messages? (i.e. attachments)
  • Should templating be done server side?

in which case

class TemplateMessage extends Message {
    string templateName;
    StringRTypeMap properties;
};

comment:10 Changed 10 years ago by atarkowska

Josh, or JoshB how the omero.cmd handle mass request?

comment:11 Changed 10 years ago by jamoore

This may not be exactly what we want since it's conceptually in a single transaction, but you can wrap any number of omero.cmd.Request objects with a DoAll. There are a couple examples in gateway/__init__.py.

comment:12 Changed 10 years ago by atarkowska

Last edited 10 years ago by atarkowska (previous) (diff)

comment:13 Changed 10 years ago by atarkowska

This code can be tested by

exp = omero.model.ExperimenterI()
exp.email = rstring("user@email.com")
req = omero.cmd.SendEmailRequest(subject="test subject", body="test message", users=[exp])
gateway = BlitzGateway(client_obj=c)
handle = c.sf.submit(req)
try:
    gateway._waitOnCmd(handle, failonerror=True)
    rsp = handle.getResponse()
finally:
    handle.close()

I am still getting LockTimeout?:

module body in test_status.py at line 39
gateway._waitOnCmd(handle, failonerror=True)
function _waitOnCmd in __init__.py at line 3382
callback.loop(loops, ms) # Throw LockTimeout
function loop in callbacks.py at line 321
5000L, int(waited))
copy output
Program exited with code #1 after 10.50 seconds.

Last edited 10 years ago by atarkowska (previous) (diff)

comment:14 Changed 10 years ago by atarkowska

comment:15 Changed 10 years ago by atarkowska

  • Type changed from Task to User Story

comment:16 Changed 9 years ago by atarkowska

  • Resolution set to fixed
  • Status changed from new to closed

comment:17 Changed 9 years ago by agilo

  • Status changed from closed to accepted

Updated status, related task in progress

comment:18 Changed 9 years ago by jamoore

  • Status changed from accepted to closed

comment:19 Changed 9 years ago by agilo

  • Status changed from closed to accepted

Updated status, related task in progress

comment:20 Changed 9 years ago by atarkowska

  • Status changed from accepted to closed
Note: See TracTickets for help on using tickets. You may also have a look at Agilo extensions to the ticket.

1.3.13-PRO © 2008-2011 Agilo Software all rights reserved (this page was served in: 0.69746 sec.)

We're Hiring!