[opencms-dev] About newsletter

Vardan Gevorgyan vgevorgy at sourcio.com
Mon Jul 10 10:33:04 CEST 2006


Hello

How can use CmsNewsletterDistributor?
I have tried like this:

<%@ page session="false" import="org.opencms.newsletter.*, 
org.opencms.jsp.*, java.util.*" %>

<%
CmsNewsletterDistributor send_mail = new CmsNewsletterDistributor();
out.println("making distributer");

CmsJspActionElement cmsa = new CmsJspActionElement(pageContext, request, 
response);
out.println("making cms object");

CmsSimpleNewsletterRecipient[] to = new CmsSimpleNewsletterRecipient[1];
to[0] = new CmsSimpleNewsletterRecipient("my_email","my_name");
List em = Arrays.asList(to);
out.println("making recipient list");

CmsNewsletter letter = new CmsNewsletter();
CmsNewsletterContent letterContent = new 
CmsNewsletterContent(1,"Hello!!!", CmsNewsletterContentType.TYPE_TEXT);
letter.addContent(letterContent);
letter.setSubject("OpenCMS newletter text");
out.println("making letter");

send_mail.distribute(cmsa.getCmsObject(), em, letter);
out.println("message was sent");
%>



More information about the opencms-dev mailing list