# Logstash imap input unable to read attachment

**URL:** <https://discuss.elastic.co/t/logstash-imap-input-unable-to-read-attachment/251143>\
**Category:** Logstash\
**Created:** [October 6, 2020, 2:27pm UTC](https://discuss.elastic.co/t/logstash-imap-input-unable-to-read-attachment/251143 "2020-10-06T14:27:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![charles97](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/charles97/32/79243_2.png) [@charles97](https://discuss.elastic.co/u/charles97)\
**Post date:** [October 6, 2020, 2:27pm UTC](https://discuss.elastic.co/t/logstash-imap-input-unable-to-read-attachment/251143/1 "2020-10-06T14:27:05Z")

</div>

I tried to parse e-mail attachment using IMAP input plugin in Logstash, but it keeps on returning error as:

```auto
[ERROR] 2020-10-06 21:33:40.789 [[main]<imap] imap - Encountered error NoMethodError {:message=>"Can not decode an entire message, try calling #decoded on the various fields and body or parts if it is a multipart message.", :backtrace=>["/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/mail-2.6.6/lib/mail/message.rb:1903:in `decoded'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-input-imap-3.0.7/lib/logstash/inputs/imap.rb:163:in `parse_mail'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-input-imap-3.0.7/lib/logstash/inputs/imap.rb:118:in `block in check_mail'", "org/jruby/RubyArray.java:1809:in `each'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-input-imap-3.0.7/lib/logstash/inputs/imap.rb:112:in `block in check_mail'", "org/jruby/RubyArray.java:1851:in `each_slice'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-input-imap-3.0.7/lib/logstash/inputs/imap.rb:110:in `check_mail'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-input-imap-3.0.7/lib/logstash/inputs/imap.rb:91:in `block in run'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/stud-0.0.23/lib/stud/interval.rb:20:in `interval'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-input-imap-3.0.7/lib/logstash/inputs/imap.rb:90:in `run'", "/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:346:in `inputworker'", "/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:337:in `block in start_input'"]}

```

here is my configuration file:

```auto
input {
    imap {
        host => "host.com"
        password => "password"
        user => "user.co.id"
        content_type => "text/html"
        folder => "TEST"
        port => "993"
    }
}

output {
    stdout { codec => rubydebug }
}

```

I've set the it to "TEST" folder and I've make sure that the email is there. It has attachment as `sample.txt` and it contains

```auto
kol1,kol2,kol3,kol4,kol5
1,2,3,4,5
11,22,33,44,55
111,222,333,444,555
1111,2222,3333,4444,5555

```

what should I do so that sample.txt could be parsed?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 3, 2020, 2:27pm UTC](https://discuss.elastic.co/t/logstash-imap-input-unable-to-read-attachment/251143/2 "2020-11-03T14:27:09Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
