Jahia allows authenticated users to subscribe to a page.
This page, a template, can be send as mail to all subscribers.
This is a standard jahia template.
It must contains a containerList of "newsletter issue" page type only.
For example if in your container definition, you can have :
page link (page[type="direct",templates="newsletterIssue"])
The issue is the template that will be send as a newsletter.
It must fit all client mail requirement. For example all styles must be declared in the tag itself, and not in a css file or in the <head>.
We strongly advise you to create separate templates for your newsletter(s).
This template will allow you to send the newsletter and test it.
Subscription uses two informations to be set.
the pages to subscribe, and the users who subscribe.
You have to :
Your mail server must be set and activated.
If only authenticated users can subscribe, they must fill their mail address to subscribe.
If you have a lot of subscribers, you must care about some blacklisting issues from your provider.
This is an example of defintion :
defintions.cnd :
[web_templates:newsletterIssue] > jnt:container
page link (page[type="direct",templates="newsletterIssue"])
file image (file[mime='image/*'])
bigText description
[web_templates:newsletter] > jnt:page,web_templates:navigation, web_templates:introduction
containerList issues (web_templates:newsletterIssue)
[web_templates:newsletterIssuePage] > jnt:page,web_templates:navigation, web_templates:introduction, jmix:sendAsNewsletter
templates.xml :
<template name="newsletter" display-name="template.name.newsletter" filename="tpl.newsletter.jsp" page-type="web_templates:newsletter" description="description.template.newsletter"/>
<template name="newsletterIssue" display-name="template.name.newsletterIssue" filename="tpl.newsletterIssue.jsp" page-type="web_templates:newsletterIssuePage" description="description.template.newsletterIssue"/>
This is a standard jahia declaration.
The only particularity is to set the issue page as jmix:sendAsNewsletter as it is set here :
[web_templates:newsletterIssuePage] > jnt:page,web_templates:navigation, web_templates:introduction, jmix:sendAsNewsletter
This indicates to Jahia the page is a newsletter. It displays send a newsletter and testNewsletter buttons.
This is an example of the newsletter template :
<template:containerList name="issues" id="issues">
<c:if test="${not empty issues}">
<ul>
<template:container id="issue">
<li>
<h3><template:field name="link"/></h3>
<p>
<template:image file="image" cssClassName="left"/>
<template:field name="description"/>
</p>
<br class="clear"/>
</li>
</template:container>
</ul>
</c:if>
</template:containerList>
It only displays links of newletter issues.
The main part is the issue. It has all constrainst from the mail client so the rendered html must be simple as possible.
tips :
- create the template for the newsletter standalone. Try to not use includes the be sure that the code is strong enougth
- use inline style definitions : <td style="padding: 8px 0 8px 0;">
the tag : <ui:subscribeButton/> allows users to subscribe to a page.
If the event is set as newsletter, it's a newsletter subscription.
If not, it's a notification subscription.
The tag gets these arguments :
event : The event type to catch. If not specified, the contentPublished event is used. [contentPublished]
source : The key of the content object to observe for changes.
user : The username to use for a subscription. If not specified, the current user is used.
confirmationRequired : Does the subscription require confirmation (an e-mail with the confirmation link will be sent first)? [false]