[
http://jira.magnolia-cms.com/browse/MAGNOLIA-2650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21626#action_21626
]
Tom Wespi commented on MAGNOLIA-2650:
-------------------------------------
here is a working patch
{code}
### Eclipse Workspace Patch 1.0
#P magnolia-taglib-utility
Index: src/main/java/info/magnolia/cms/taglibs/util/SimpleMailTag.java
===================================================================
--- src/main/java/info/magnolia/cms/taglibs/util/SimpleMailTag.java
(revision 23312)
+++ src/main/java/info/magnolia/cms/taglibs/util/SimpleMailTag.java
(working copy)
@@ -227,7 +227,7 @@
* @see javax.servlet.jsp.tagext.TagSupport#doEndTag()
*/
public int doEndTag() throws JspException {
-
+
HttpServletRequest request = (HttpServletRequest)
pageContext.getRequest();
StringBuffer body = new StringBuffer(); // build and send email
@@ -262,22 +262,24 @@
while (it.hasNext()) {
Content node = (Content) it.next();
String[] values = request.getParameterValues("field_" +
node.getName());
+
if (values == null) {
values = request.getParameterValues(node.getName());
}
+
if (values != null) {
-
body.append(node.getNodeData("title").getString()).append('\n');
+ body.append("<b>" + node.getNodeData("title").getString() +
"</b>").append("<br/>");
mailTitles.append(excelCSVFormat(node.getNodeData("title").getString())).append(';');
StringBuffer csvValue = new StringBuffer();
for (int i = 0; i < values.length; i++) {
- body.append(values[i]).append('\n');
+ body.append(values[i]).append("<br/>");
csvValue.append(values[i]);
if (i < values.length - 1) {
csvValue.append('\n');
}
}
mailValues.append(excelCSVFormat(csvValue.toString())).append(';');
- body.append("\n");
+ body.append("<br/>");
}
}
@@ -295,20 +297,22 @@
Map parameters = new HashMap(request.getParameterMap());
// TODO: avoid those kinds of redundacies in the mail system
if (StringUtils.isEmpty(template)) {
- email =
MailModule.getInstance().getFactory().getEmail(parameters);
- email.setBody();
+ email =
MailModule.getInstance().getFactory().getEmailFromType(parameters, mailType);
+ email.setBody(body.toString());
}
else {
parameters.put("all", body.toString());
email =
MailModule.getInstance().getFactory().getEmailFromTemplate(template,
parameters);
email.setBodyFromResourceFile();
}
- /* email.setToList(to);
+
+ email.setToList(to);
email.setCcList(cc);
email.setBccList(bcc);
email.setReplyToList(replyTo);
email.setFrom(from);
- email.setSubject(subject);*/
+ email.setSubject(subject);
+
MailModule.getInstance().getFactory().getEmailHandler().sendMail(email);
}
catch (Exception e) {
{code}
> <cmsu:simpleMail -> Couln't instantiate email type: null
> --------------------------------------------------------
>
> Key: MAGNOLIA-2650
> URL: http://jira.magnolia-cms.com/browse/MAGNOLIA-2650
> Project: Magnolia
> Issue Type: Bug
> Components: taglibs
> Affects Versions: 4.0 RC4
> Reporter: Tom Wespi
> Assignee: Teresa Miyar
> Attachments: stacktrace.txt
>
>
> Insert in a jspx:
> <cmsu:simpleMail
> subject="test"
> to="[email protected]"
> from="[email protected]"
> type="simple"
> />
> Stacktrace attached
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.magnolia-cms.com/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------