Saturday 2 October 2010

Send HTML email from alfresco 3.3 with attachment tutorial and code








In my first blog I will provide you with feature to send email using alfresco javascript by executing action and sending HTML email, also you can send attachment with this mail you can use templates and so on, same as using old mail action.

first javascript:

var mail = actions.create("mail2");
mail.parameters.to = "savic.prvoslav[at]gmail.com";
mail.parameters.subject = "Html test";
mail.parameters.from = "savic.prvoslav[at]gmail.com";
mail.parameters.text = "My name is Savić Prvoslav<b> if you see this it is very bold</b>";

mail.parameters.node=document;
//here you set document to sent via email, you can comment this line if you do not want to send doc :)
mail.execute(document);








you can download jar-source-file .


How to install: 
 put jar file in alfresco/web-inf/lib , restart alfresco, use the javascript.


How to set up Outbound Email Configuration for Gmail:
alfresco3.3G\tomcat\shared\classes\alfresco-global.properties


#
# Outbound Email Configuration
#-------------
mail.host=smtp.gmail.com
mail.port=465
mail.protocol=smtps
mail.username=username
mail.password=pass
mail.smtps.starttls.enable=true
mail.smtps.auth=true
mail.from.default=defaultEmail

















In case of passing the rapidshare.limit just post comment and I will update file for you.