How do you work with seam mail and styles in a good way? I have googled this for hours but I can’t find a good way to style my emails. The datatable comes out with no style at all, not even “standard” borders etc. Seam version is 2.2.2.
Basically what is good practice for sending mails with style? Examples are very appreciated.
Facelet below:
<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"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
xmlns:s="http://jboss.com/products/seam/taglib">
<m:from name="#{message.mailFrom}" address="k.kilden@logica.com" />
<m:to name="mailFromName" address="k.kilden@logica.com" />
<m:subject>
<h:outputText value="#{message.mailTopic} Orderid: #{order.id}" />
</m:subject>
<m:body>
<f:facet name="alternative">Sorry, your email reader can't show our fancy email</f:facet>
<html>
<head>
<a4j:loadBundle var="message" basename="messagesGenericPurchase" />
<link href="#{facesContext.externalContext.requestContextPath}/stylesheet/mail.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h2>#{message.mailHeadLine} #{order.form.name}</h2>
<hr style="border:1px solid red;"></hr>
<h:outputText value="#{message.mailOrderHead}"
style="font-weight:bold; line-height:20px;" />
<rich:dataTable var="hField" value="#{order.headFields}">
<rich:column style="width: 100px;">
<h:outputText value="#{hField.field.label}" />
</rich:column>
<rich:column style="width: 100px border:2px;">
<h:outputText value="#{hField.value}" style="border:2px;"/>
</rich:column>
</rich:dataTable>
</body>
</html>
</m:body>
</m:message
Generated output in outlook:
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><link href="http://dl.dropbox.com/u/860312/genericPurchase.css" rel="stylesheet" type="text/css">
</head>
<body>
<h2>Ny beställning: Arbetskläder3</h2>
<hr style="border:1px solid red;"><span style="font-weight:bold; line-height:20px;">Orderhuvud</span><table class="rich-table " id="j_id11" border="0" cellpadding="0" cellspacing="0"><colgroup span="2"></colgroup><tbody id="j_id11:tb"><tr class="rich-table-row rich-table-firstrow "><td class="rich-table-cell " id="j_id11:0:j_id12" style="width: 100px;">test</td><td class="rich-table-cell " id="j_id11:0:j_id14" style="width: 100px border:2px;"><span style="border:2px;">asd</span></td></tr><tr class="rich-table-row "><td class="rich-table-cell " id="j_id11:1:j_id12" style="width: 100px;">test</td><td class="rich-table-cell " id="j_id11:1:j_id14" style="width: 100px border:2px;"><span style="border:2px;">asd</span></td></tr><tr class="rich-table-row "><td class="rich-table-cell " id="j_id11:2:j_id12" style="width: 100px;">test</td><td class="rich-table-cell " id="j_id11:2:j_id14" style="width: 100px border:2px;"><span style="border:2px;">asd</span></td></tr></tbody></table>
</body>
</html>
Could not get this to work. Solution was to throw it out and use java mail