cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a email notification when a new site is created

samnaction
Champ in-the-making
Champ in-the-making
Whenever a new site is created the user has to get an email notification as " A new site named sample is created. Click this link to join the site"
I tried to create a rule and execute a script when a particular site is created

var parent = space.getParent();
var siteShortName = space.getSiteShortName();
var siteGroup = "GROUP_EMAIL_CONTRIBUTORS";
var mail = actions.create("mail");
mail.parameters.to_many = siteGroup;

mail.parameters.subject=" A new site called" +siteShortName +"is created";
mail.parameters.text="Login to share to join the site;

//execute action against a document
mail.execute(document);


But I am getting the mail as "A new site callednullis created" as subject‏. It is not showing the site name instead it saying null
16 REPLIES 16

sanket
Champ on-the-rise
Champ on-the-rise
If my above post does not work, try adding these properties to alfresco-global.properties. Restart the server and then check.

# Set this value to UTF-8 or similar for encoding of email messages as required
mail.encoding=UTF-8
# Set this value to 7bit or similar for Asian encoding of email headers as required
mail.header=7bit


Also, try by putting this code in your js file:

mail.parameters.to = "your_email_id";

instead of

mail.parameters.to_many = siteGroup;

samnaction
Champ in-the-making
Champ in-the-making
I found the issue is related to number of members in the group. If the the group email contributor has two members it will send two mails, three members then three and so on

samnaction
Champ in-the-making
Champ in-the-making
Any idea on how to do stop this??

sanket
Champ on-the-rise
Champ on-the-rise
Can you share the script (js file) here ? That will give a clear idea.
Secondly, if there are three users in your email contributor group, all those three users have the same email id set on them ?

samnaction
Champ in-the-making
Champ in-the-making

function sendMail()
{
var siteGroup = "GROUP_EMAIL_CONTRIBUTORS";
var mail = actions.create("mail");
mail.parameters.to_many = siteGroup;
var url = "Click http://pc1:8080/share/page/site/" + document.properties.name + "/dashboard" + "   to join the site";
mail.parameters.subject="New Site Created in Community";
mail.parameters.text=url;
//execute action against a document
mail.execute(document);
}
sendMail();


This is the script. Find the attached image. These three users were the member of Email_collborators. 

samnaction
Champ in-the-making
Champ in-the-making
Please find the screen shot of mail I am getting

sanket
Champ on-the-rise
Champ on-the-rise