roxen.lists.roxen.general

Subject Author Date
Re: email tag attributes appending Peter_Jönsson <peter[at]kolumn[dot]se> 11-03-2007
Hej,

It do sounds a bit like a bug as you describe it.

Haven't tested it myself but it seems like if you could omit the  
separator="," from the <email> tag since it doesn't make any sense if  
you never insert any comma-delimited strings in any of the to, cc or  
bcc attributes. Likewise - why do you send the same email as to and  
cc to the same address?

To make sure that there are no cache-related problems involved here  
you should enclose this code in a <nocache></nocache> if you haven't  
done so already (the described behaviour seems odd anyway but  
nevertheless..)

Lastly I believe that html-only formatted emails are a bit  
problematic for other reasons. You should try to use a multipart- 
formatted email if you are not absolutely certain that everyone that  
recieves the email uses (and wants to use) html-emailing. Here is a  
framework for building a multipart mail with the email-tag:
____
<email from="<fromadress[at]domain.se>" to="<someone[at]domain.se>"  
subject="subject">
		<header name="MIME-Version">1.0</header>
		<header name="Content-Type">multipart/alternative;  
charset=iso-8859-1; boundary="This_is_the_boundary_hip_ho"</header>
		
(shown for non MIME readers)	This email is MIME-formated with both a  
html-version and a plain text version. Please use a MIME compliant  
email-client to read it.

--This_is_the_boundary_hip_ho

Content-Type: text/plain;  charset=iso-8859-1
Content-Transfer-Encoding: 7bit

Plaintext....

This is the plaintext version of the email.
		
--This_is_the_boundary_hip_ho

Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: 7bit

		<html>
			<head>
				<title>The title</title>
				<style type="text/css">
					
				</style>
			</head>
			<body>
				<p>html version body</p>
			</body>
		</html>


--This_is_the_boundary_hip_ho--

	</email>
____

As you can see all the magic derives from the boundary attribute in  
<header name="Content-Type">. Just use the same string preceeded with  
-- to separate the mailparts and use --boundarystring-- to tell the  
client that this was the last part/end of email. Naturaly the  
boundary string should be one that never would occur in the textparts.

As an extra plus you can specify the content type for each part as  
plaintext in your code without using <header> tags to have roxen do  
it for you ;)

Good luck, please get back to the list so we can rule out or possibly  
fix any bugs related to your problem

best regards
Peter


--- David Hunter <<dhunter[at]pauanui.net.nz>> wrote:

 > when using the below code (same applies to using
 > source="sql" in the
 > emit tag),
 > the cc address appends to the one from the previous
 > emit (in the
 > resulting email only, not if i output the value in
 > the called page).
 > I also get duplication of the content type.
 >
 >
 > The first email is fine but the second email the
 > headers contain
 >
 > Cc: emailaddress1, emailaddress2
 >
 > Content-Type: text/html; charset=US-ASCII,text/html;
 > charset=US-ASCII;charset="iso-8859-1"
 >
 >
 > This does not happen if i set the content-type in
 > the administration
 > interface for the email tag.
 >
 > how can i set the content type to html for only some
 > of my email tag
 > usage without having to set it for the whole site?
 > or is this a bug?.
 >
 > <emit source="values"
 > values="emailaddress1,emailaddress1" split=",">
 > <email from="emailaddress" to="&_.value;"
 > cc="&_.value;" separator=","
 > server="mymailserver" subject="Test &_.value;">
 > <header name="Content-type" value="text/html;
 > charset=US-ASCII" />
 > Test only
 > </email>
 > </emit>
 >
 >
 > David Hunter.
 >
 >