Support Questions

Find answers, ask questions, and share your expertise

Oozie email action with content_type (text/html) and attachment tag is sending mail in normal text/plain format

New Contributor

My application work with some dynamic generated files & once my workflow is complete, I need to send the details of files in the success mail in a table format. After going through oozie docs I figured out that we can use <content_type>text/html</content_type> to do the same.

My code is working fine if I use only <content_type> tag in oozie email action (mail body is delivered in table format). But I need to use <attachment> tag as well in my email action. While doing the same, the <content_type> tag isn't working as expected & I'm receiving mail in text/plain format.

Given below is my code snippet

<action name="success">
   <email xmlns="uri:oozie:email-action:0.2">
      <to>${recipients}</to>
      <subject>${from_env} Success: Workflow ${wf:name()} completed successfully</subject>
      <body>
         <![CDATA[
         <table>
            <tr><td>   WORKFLOW NAME </td>       <td> : ${wf:name()}   </td></tr>
            <tr><td>   WORKFLOW ID </td>     <td> : ${wf:id()}        </td></tr>
            <tr><td>   ACO NAME </td>       <td> : ${acoName}        </td></tr>
            <tr><td>   ACO_ID </td>         <td> : ${acoId}      </td></tr>
            <tr><td>   CUSTOMER_ID </td>     <td> : ${customerID}  </td></tr>
            <tr><td>   SUPPLIER_ID </td>     <td> : ${supplierId}  </td></tr>
            <tr><td>   APP PATH </td>       <td> : ${wf:appPath()} </td></tr>
         </table>	
	<table>
		<tr>
			<td>File1.txt</td>
			<td>File_absent</td>
		</tr>
		<tr>
			<td>File2.txt</td>
			<td>File_present</td>
		</tr>
	</table>
	]]>      
	</body>      
	<content_type>text/html</content_type>
	<attachment>${filePath}</attachment>
   </email>

Note:

1- If I'm not using the <attachment> tag email-action is working fine & i'm receiving mail in table format

2- While using <content_type> & <attachment> tag together it is not working as expected

Any help appreciated!! Thanks!

3 REPLIES 3

New Contributor

I am facing the same issue. Did you find the solution?

New Contributor

Facing the same issue, while the <content_type> is text/html and <attachment> specified, sends mail in text/plain format.

Any work-around/solutions would be much appreciated.

New Contributor

I am facing the same issue to. Did you find the solution?

Issue 2017 year, but we are using oozie in our solution now