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

ASF GitHub Bot commented on NIFI-5252:
--------------------------------------

Github user ottobackwards commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2787#discussion_r194700389
  
    --- Diff: 
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/PutEmail.java
 ---
    @@ -319,6 +330,15 @@ public void onTrigger(final ProcessContext context, 
final ProcessSession session
                 message.setRecipients(RecipientType.CC, 
toInetAddresses(context, flowFile, CC));
                 message.setRecipients(RecipientType.BCC, 
toInetAddresses(context, flowFile, BCC));
     
    +            final String attributeNameRegex = 
context.getProperty(ATTRIBUTE_NAME_REGEX).getValue();
    +            final Pattern attributeNamePattern = attributeNameRegex == 
null ? null : Pattern.compile(attributeNameRegex);
    +            if (attributeNamePattern != null) {
    +                for (final Map.Entry<String, String> entry : 
flowFile.getAttributes().entrySet()) {
    +                    if 
(attributeNamePattern.matcher(entry.getKey()).matches()) {
    --- End diff --
    
    There are rules about how the headers have to be encoded.  We should use 
the MimeUtility to ensure everything is encoded correctly.
    
    ```
    Note that RFC 822 headers must contain only US-ASCII characters, so a 
header that contains non US-ASCII characters must have been encoded by the 
caller as per the rules of RFC 2047.
    ```
    
    
[MimeUtility](https://docs.oracle.com/javaee/6/api/javax/mail/internet/MimeUtility.html)
    
    We should also have tests for ensuring attributes with content that must be 
encoded are handled.


> Allow arbitrary headers in PutEmail processor
> ---------------------------------------------
>
>                 Key: NIFI-5252
>                 URL: https://issues.apache.org/jira/browse/NIFI-5252
>             Project: Apache NiFi
>          Issue Type: Improvement
>            Reporter: Dustin Rodrigues
>            Priority: Minor
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to