Sending email with multiple <m:to> tags or with <ui:repeat> interation causes
multiple "To:" header fields (doesn't work and not compliant with RFC-5322)
---------------------------------------------------------------------------------------------------------------------------------------------------------
Key: JBSEAM-4465
URL:
https://jira.jboss.org/jira/browse/JBSEAM-4465
Project: Seam
Issue Type: Bug
Components: Mail
Affects Versions: 2.2.0.GA
Environment: Fedora 11, Seam 2.2.0.GA, Jboss 5.1.0.GA,
Reporter: Robert Hare
Assignee: Pete Muir
Use of multiple <m:to> or iterated over with <ui:repeat> tags will cause
multiple "To:" header fields as opposed to a comma separated address list on a
single "To:" field as required by RFC-5322. Very easy to duplicate and code is
directly from examples. Note this same behavior also occurs for <m:cc> fields.
I actually think I must be doing something wrong, since this seams like a major issue that
would have had to have been discovered long before now, but the forums haven't helped
and it's straight from the examples.
----- test.xhtml
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
xmlns:s="http://jboss.com/products/seam/taglib"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:rich="http://richfaces.org/rich"
template="layout/template.xhtml">
<ui:define name="body">
<s:button value="test" action="#{testEmail.test}"/>
</ui:define>
</ui:composition>
----- TestEmail.java
package com.hc.skiclub.session;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.In;
import org.jboss.seam.faces.FacesMessages;
import org.jboss.seam.faces.Renderer;
@Name("testEmail")
public class TestEmail
{
@In private FacesMessages facesMessages;
@In (create=true) private Renderer renderer;
public String test()
{
// Send email.
try {
renderer.render("/TestEmail.xhtml");
facesMessages.add("Email sent successfully");
} catch (Exception e) {
facesMessages.add("Email sending failed: " + e.getMessage());
return "fail";
}
return "success";
}
}
----- TestEmail.xhtm (substitute in valid email address for "user@domain"
below)
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<m:message
xmlns="http://www.w3.org/1999/xhtml"
xmlns:m="http://jboss.com/products/seam/mail"
xmlns:h="http://java.sun.com/jsf/html">
<m:from name="Rob" address="user@domain"/>
<m:to name="Rob1" address="user@domain" />
<m:to name="Rob2" address="user@domain" />
<m:subject>Test Email </m:subject>
<m:body>
Broken?
</m:body>
</m:message>
----------- Example of mail message sent/received (DOMAIN substituted for real domain),
notice two "To:" headers.
From rhare@DOMAIN Mon Nov 2 12:19:07 2009
Return-Path:
<rhare@DOMAIN>
Date: Mon, 2 Nov 2009 12:19:07 -0500
From: Rob <rhare@DOMAIN>
To: Rob1 <rhare@DOMAIN>
To: Rob2 <rhare@DOMAIN>
Subject: Test Email
Content-Type: multipart/mixed;
boundary="----=_Part_3_19189971.1257182347228"
Status: R
Part 1:
Content-Type: text/html; charset=ISO-8859-1
Content-Disposition: inline
Broken?
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira