[ 
https://issues.apache.org/jira/browse/NIFI-1912?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15342142#comment-15342142
 ] 

Max Houck commented on NIFI-1912:
---------------------------------

Would this fix it?

{code:title=PutEmail.java|borderStyle=solid}
if (context.getProperty(ATTACH_FILE).asBoolean()) {
                final MimeBodyPart mimeText = new 
PreencodedMimeBodyPart("base64");
                mimeText.setDataHandler(new DataHandler(new ByteArrayDataSource(
                        Base64.encodeBase64(messageText.getBytes("UTF-8")), 
contentType + "; charset=\"utf-8\"")));
{code}

I'm new to all this, I apologize for the poor formatting. Would using the 
contentType string from above instead of always text/plain solve the problem 
here?

> PutEmail doesn't send formatted email when there is an attachment with the 
> message
> ----------------------------------------------------------------------------------
>
>                 Key: NIFI-1912
>                 URL: https://issues.apache.org/jira/browse/NIFI-1912
>             Project: Apache NiFi
>          Issue Type: Bug
>    Affects Versions: 0.6.1
>            Reporter: Ravi Bhushan Ratnakar
>            Priority: Critical
>
> When I am trying to send formatted email with an attachment using PutEmail 
> processor, all the html tags are displayed as it is like a text(<b>This</b>).
> After going through the code what i observed that when there is an 
> attachment, in that case content type is hard coded to 'text/plain'. Below 
> code  snippet from PutEmail 
> if (context.getProperty(ATTACH_FILE).asBoolean()) {
>                 final MimeBodyPart mimeText = new 
> PreencodedMimeBodyPart("base64");
>                 mimeText.setDataHandler(new DataHandler(new 
> ByteArrayDataSource(
>                         Base64.encodeBase64(messageText.getBytes("UTF-8")), 
> "text/plain; charset=\"utf-8\"")));



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to