The Mailer Servlet sample demonstrates how a servlet can be used to send MIME e-mail messages. Better yet, this mailer servlet can also send Embedded Experiences payloads! See OpenSocial for more information on Embedded Experiences. This servlet demonstrates how to parse JSON that is POSTed to the servlet, process user privileges, create a document, add MIME parts to it, and send it.

This servlet will be utilized during the "SHOW115 - Socialize your Applications using OpenSocial" Show and Tell session at Lotusphere 2012. If you are interested in building social applications and will be at Lotusphere 2012, stop by and see us!

Usage: The POST body must be JSON, for example:

   "To":"Stanton Sievers/Acme, Ryan Baxter/Acme",
   "CC":"John Doe/Acme",
   "BCC":"Jane Doe/Acme",
   "Subject":"Test e-mail",
      "text_plain":"plain text",

The servlet can operate in two different ways:
- As a standalone servlet, i.e., http://<hostname>/mailer
- Through a database, i.e., http://<hostname>/mailer.nsf/mailer.  

If used standalone the servlet MUST have an authenticated user (via SSO for instance) or else the servlet will return a 400 error.  When used standalone the authenticated user's mail database will be used to create and send the document.
If used through a database the servlet will try to create the document in the database (mailer.nsf in the example above).  This is done in two ways:
- If an authenticated user does not have "Create Document" privileges to the database, their mail file will be used.  
- If an anonymous user does not have "Create Document privileges", the servlet will return a 400 error.  
- Unfortunately if the given user (authenticated or otherwise) has "No Access" to the given database the Domino Server may return a 200 response with the login page as the response body.

comments powered byDisqus