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

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

Github user ijokarumawak commented on the issue:

    https://github.com/apache/nifi/pull/1857
  
    I've tested with [GreenMail](http://www.icegreen.com/greenmail/#examples) 
server, which can be deployed with Docker or standalone Java app and NiFi Email 
processors can talk with it seamlessly.
    
    For POP3, if messages are not deleted, the same message can be fetched 
again and again. So confirming whether it is deleted or not is easy.
    
    For IMAP, there's some smart fetch mechanism is going on, so ConsumeIMAP 
can not be fetch the same messages again, even if it remains in the mail server.
    I used `telnet` command to confirm that messages are deleted (or remains) 
based on the 'Delete Message' setting:
    
    ```
    # Used different users
    # Delete Message=True
    $ telnet `docker-machine ip` 3143
    Trying 192.168.99.100...
    Connected to nifi-cp.local.
    Escape character is '^]'.
    ? LOGIN us...@example.com us...@example.com
    ? STATUS INBOX (MESSAGES)
    * STATUS "INBOX" (MESSAGES 1)
    ? STATUS INBOX (MESSAGES) // After consumed by NiFi
    * STATUS "INBOX" (MESSAGES 0)
    
    # Delete Message=False
    $ telnet `docker-machine ip` 3143
    Trying 192.168.99.100...
    Connected to nifi-cp.local.
    Escape character is '^]'.
    ? LOGIN us...@example.com us...@example.com
    ? STATUS INBOX (MESSAGES)
    * STATUS "INBOX" (MESSAGES 1)
    ? STATUS INBOX (MESSAGES)
    * STATUS "INBOX" (MESSAGES 1) // After consumed by NiFi
    ? OK STATUS completed.
    ```
    
    Here is a NiFi flow template I used for testing available in 
[Gist](https://gist.github.com/ijokarumawak/f898a4a38b3091ce59868584052e030c).


> ConsumePOP3 and ConsumeIMAP do NOT delete messages
> --------------------------------------------------
>
>                 Key: NIFI-3976
>                 URL: https://issues.apache.org/jira/browse/NIFI-3976
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Extensions
>    Affects Versions: 1.0.0
>            Reporter: Koji Kawamura
>            Assignee: Koji Kawamura
>
> Those processors have 'Delete Messages' property but even if user configured 
> it to 'true' messages are not deleted from mail server.
> AbstractEmailProcessor which is a superclass for both processors, has been 
> using:
> {code}
> emailMessage.setFlag(Flags.Flag.DELETED, this.shouldSetDeleteFlag);
> {code}
> However, since we are using Spring mail, the underlying receiver does not 
> close the inbox connection so messages are not deleted.
> Instead, we should use:
> {code}
> receiver.setShouldDeleteMessages(boolean)
> {code}
> To specify whether it should delete fetched messages or not.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to