[jbossseam-issues] [JBoss JIRA] Updated: (JBSEAM-4465) 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)

Robert Hare (JIRA) jira-events at lists.jboss.org
Tue Nov 17 01:37:29 EST 2009


     [ https://jira.jboss.org/jira/browse/JBSEAM-4465?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Robert Hare updated JBSEAM-4465:
--------------------------------

    Description: 
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 at 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 at domain"/>
    <m:to name="Rob1" address="user at domain" />
    <m:to name="Rob2" address="user at 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 at DOMAIN  Mon Nov  2 12:19:07 2009
Return-Path: <rhare at DOMAIN>
Date: Mon, 2 Nov 2009 12:19:07 -0500
From: Rob <rhare at DOMAIN>
To: Rob1 <rhare at DOMAIN>
To: Rob2 <rhare at 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?

 ----------------------
Note, I have discovered that this problem may be hidden on many platforms.  For example, the MTA at yahoo seems to accept multiple To: headers and deliver the mail just fine, while the sendmail MTA on Fedora 11 doesn't, it only sends to the first To: header.  Also, some mail readers also hide the problem.  For instance, under evolution and UNIX mail (yes old school), you will clearly see multiple To: headers. However, Outlook (I think - this is second hand) will combine multiple To: headers and show only 1 with the recipients separated by commas.  


  was:
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 at 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 at domain"/>
    <m:to name="Rob1" address="user at domain" />
    <m:to name="Rob2" address="user at 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 at DOMAIN  Mon Nov  2 12:19:07 2009
Return-Path: <rhare at DOMAIN>
Date: Mon, 2 Nov 2009 12:19:07 -0500
From: Rob <rhare at DOMAIN>
To: Rob1 <rhare at DOMAIN>
To: Rob2 <rhare at 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?

 




> 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 at 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 at domain"/>
>     <m:to name="Rob1" address="user at domain" />
>     <m:to name="Rob2" address="user at 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 at DOMAIN  Mon Nov  2 12:19:07 2009
> Return-Path: <rhare at DOMAIN>
> Date: Mon, 2 Nov 2009 12:19:07 -0500
> From: Rob <rhare at DOMAIN>
> To: Rob1 <rhare at DOMAIN>
> To: Rob2 <rhare at 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?
>  ----------------------
> Note, I have discovered that this problem may be hidden on many platforms.  For example, the MTA at yahoo seems to accept multiple To: headers and deliver the mail just fine, while the sendmail MTA on Fedora 11 doesn't, it only sends to the first To: header.  Also, some mail readers also hide the problem.  For instance, under evolution and UNIX mail (yes old school), you will clearly see multiple To: headers. However, Outlook (I think - this is second hand) will combine multiple To: headers and show only 1 with the recipients separated by commas.  

-- 
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

        


More information about the seam-issues mailing list