09-22-2010 08:37 AM
<b>A new document '${document.name}'</b>, is available.
It was added by ${person.properties.firstName}<#if person.properties.lastName?exists> ${person.properties.lastName}</#if>.
Regards
Alfresco
09-22-2010 11:24 AM
MimeMessageHelper message = new MimeMessageHelper(mimeMessage,
true);
System.out.println(email + " " + from);
message.setTo(email);
message.setSubject(subject);
System.out.println("body :" + body);
message.setText(body, true);
message.setFrom(from);
message.setReplyTo(new InternetAddress(from));
09-23-2010 04:52 AM
code is like this:MimeMessageHelper message = new MimeMessageHelper(mimeMessage,
true);
System.out.println(email + " " + from);
message.setTo(email);
message.setSubject(subject);
System.out.println("body :" + body);
message.setText(body, true);
message.setFrom(from);
message.setReplyTo(new InternetAddress(from));
and this is not the code that is used in alfresco, they use message.setText(body); and mail is not HTML
09-23-2010 05:21 AM
public void notifyUser(NodeRef person, NodeRef node, final String from, String roleText)
{
final String to = (String)this.getNodeService().getProperty(person, ContentModel.PROP_EMAIL);
if (to != null && to.length() != 0)
{
String body = this.body;
if (this.usingTemplate != null)
{
FacesContext fc = FacesContext.getCurrentInstance();
// use template service to format the email
NodeRef templateRef = new NodeRef(Repository.getStoreRef(), this.usingTemplate);
ServiceRegistry services = Repository.getServiceRegistry(fc);
Map<String, Object> model = DefaultModelHelper.buildDefaultModel(
services, Application.getCurrentUser(fc), templateRef);
model.put("role", roleText);
model.put("space", node);
// object to allow client urls to be generated in emails
model.put("url", new BaseTemplateContentServlet.URLHelper(fc));
body = services.getTemplateService().processTemplate("freemarker", templateRef.toString(), model);
}
this.finalBody = body;
MimeMessagePreparator mailPreparer = new MimeMessagePreparator()
{
public void prepare(MimeMessage mimeMessage) throws MessagingException
{
MimeMessageHelper message = new MimeMessageHelper(mimeMessage);
message.setTo(to);
message.setSubject(subject);
message.setText(finalBody,true); //HIRE IS THE CHANGE.
message.setFrom(from);
}
};
if (logger.isDebugEnabled())
logger.debug("Sending notification email to: " + to + "\n…with subject:\n" + subject + "\n…with body:\n" + body);
try
{
// Send the message
this.getMailSender().send(mailPreparer);
}
catch (Throwable e)
{
// don't stop the action but let admins know email is not getting sent
logger.error("Failed to send email to " + to, e);
}
}
}
09-23-2010 06:53 AM
Well I did not find way to override this problem so org.alfresco.web.bean.users.TemplateMailHelperBean
this is the class, you can it is located inside of alfesco-web-client.jar, and you can just rebuld it( no need to rebuild all of the alfresco) .public void notifyUser(NodeRef person, NodeRef node, final String from, String roleText)
{
final String to = (String)this.getNodeService().getProperty(person, ContentModel.PROP_EMAIL);
if (to != null && to.length() != 0)
{
String body = this.body;
if (this.usingTemplate != null)
{
FacesContext fc = FacesContext.getCurrentInstance();
// use template service to format the email
NodeRef templateRef = new NodeRef(Repository.getStoreRef(), this.usingTemplate);
ServiceRegistry services = Repository.getServiceRegistry(fc);
Map<String, Object> model = DefaultModelHelper.buildDefaultModel(
services, Application.getCurrentUser(fc), templateRef);
model.put("role", roleText);
model.put("space", node);
// object to allow client urls to be generated in emails
model.put("url", new BaseTemplateContentServlet.URLHelper(fc));
body = services.getTemplateService().processTemplate("freemarker", templateRef.toString(), model);
}
this.finalBody = body;
MimeMessagePreparator mailPreparer = new MimeMessagePreparator()
{
public void prepare(MimeMessage mimeMessage) throws MessagingException
{
MimeMessageHelper message = new MimeMessageHelper(mimeMessage);
message.setTo(to);
message.setSubject(subject);
message.setText(finalBody,true); //HIRE IS THE CHANGE.
message.setFrom(from);
}
};
if (logger.isDebugEnabled())
logger.debug("Sending notification email to: " + to + "\n…with subject:\n" + subject + "\n…with body:\n" + body);
try
{
// Send the message
this.getMailSender().send(mailPreparer);
}
catch (Throwable e)
{
// don't stop the action but let admins know email is not getting sent
logger.error("Failed to send email to " + to, e);
}
}
}
this would be in your case, because you are using notifying the users of space change. this change would not take more then 20 min. hope it helped.
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.