Sending e-mails using a mail template
In this recipe, we will create a Web Script that will send a mail to a particular defined user. The content of the mail will be driven by a mail template. Finally, the mail content is returned as the Web Script response.
How to do it...
1. We will first create a Mail Template. Here is the template:
Hello ${person.properties["cm:firstName"]}, Welcome to Alfresco! Here are your registration details. First Name: ${person.properties["cm:firstName"]} Last Name: ${person.properties["cm:lastName"]} User Name: ${person.properties["cm:userName"]} Enjoy your Stay! Regards, the Alfresco Team.
2. Save this template in the Company Home | Data Dictionary | EMail Templates folder—with the name
userdetailsmail.ftl
3. Now, we will create new files for the web script; let's name this script as
sendusermail
.4. Open a text editor and create a new file with this code:
<webscript> <shortname>Send Mail</shortname> <description>Searches for a user and sends...