Sakai's EmailService is easy to use, but limited in features. Developers of Sakai tools just need to call EmailService.send() with minimal options such as the recipient's email address, subject, and message. But it does not accommodate attachments, instead offering the file picker as a workaround.
The Mailtool (in version 2.3) refactored EmailService for attachment capability, and duplicated much of the EmailService code in to create a "local" version of EmailService handling under a method called processSendEmail() (see the link to Mailtool.java below).
As a point of comparison, the Message Center has two main functions for communicating among site members: discussion forums and private messaging. Private messaging of MC is almost the same as Mailtool - sending messages to site members. It also has own mailbox while Mailtool uses the Email Archive tool as its mailbox. MC's private messaging can send attachments using the File picker (redirect to Resource and then send the link, not the file itself).
But many of our use cases involve attachments relevant for the message, yet not files that the sender cares to upload to resources. Redirecting them to additional screens for attachment handling has also been a usability complaint - they want something quicker and easier.
The current proposed enhancements to EmailService would essentially add handling for both attachments and MIME messages.
Proposed Enhancements to EmailService
The following introduces a new send method that uses a container object rather than passing each parameter as an argument. The current methods of EmailService will stay for backwards compatibility.
The full EmailMessage object is attached. The propeties are shown below.
By using classes that are not directly dependent on javax.mail, using the EmailService to send messages doesn't also require another build dependency. This will allow for easier mail implementation upgrades.
Mailtool's processSendEmail(): https://source.sakaiproject.org/contrib/mailtool/branches/2.3.x/src/java/org/sakaiproject/tool/mailtool/Mailtool.java
(it's attachment-enabled. <sakai:inputFileUpload> takes care of file upload. Mailtool just gets the location(absolute file path) of uploaded file in Sakai server)