# Unable to process attachments using logstash 7.6.0 IMAP Input plugin

**URL:** <https://discuss.elastic.co/t/unable-to-process-attachments-using-logstash-7-6-0-imap-input-plugin/227416>\
**Category:** Logstash\
**Created:** [April 9, 2020, 11:03pm UTC](https://discuss.elastic.co/t/unable-to-process-attachments-using-logstash-7-6-0-imap-input-plugin/227416 "2020-04-09T23:03:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Diptee](https://avatars.discourse-cdn.com/v4/letter/d/76d3ee/32.png) [@Diptee](https://discuss.elastic.co/u/Diptee)\
**Post date:** [April 9, 2020, 11:03pm UTC](https://discuss.elastic.co/t/unable-to-process-attachments-using-logstash-7-6-0-imap-input-plugin/227416/1 "2020-04-09T23:03:52Z")

</div>

```auto
I have configured logstash input to process emails from Gmail/Outlook using IMAP Input plugin. I am getting error when the email contains attachments or images. 
Sample config below-

input {
	imap {
		host => "xyz.com"
		password => "acc"
		user => "user"
		content_type => "multipart/alternative"
	 }
}

Below error details-
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.

Any help appreciated.

Thanks.

```

---

<div class="post-metadata">

**Author:** ![Luca\_Belluccini](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luca_belluccini/32/33239_2.png) [@Luca\_Belluccini](https://discuss.elastic.co/u/Luca_Belluccini)\
**Post date:** [April 9, 2020, 11:35pm UTC](https://discuss.elastic.co/t/unable-to-process-attachments-using-logstash-7-6-0-imap-input-plugin/227416/2 "2020-04-09T23:35:49Z")

</div>

Hello @Diptee

You seem to be facing this limitation:

> <https://github.com/logstash-plugins/logstash-input-imap/issues/47>
>
> The IMAP input fails to parse emails with inline attachments. It defaults to grabbing the first mail part if the content...

There are few pending Pull Request to improve attachment behavior:

> <https://github.com/logstash-plugins/logstash-input-imap/pull/49>

> <https://github.com/logstash-plugins/logstash-input-imap/pull/48>

I've never personally used the Logstash `imap` input plugin, but there's an option `strip_attachments` ([doc](https://www.elastic.co/guide/en/logstash/current/plugins-inputs-imap.html#plugins-inputs-imap-strip_attachments)) to ignore them

---

<div class="post-metadata">

**Author:** ![Diptee](https://avatars.discourse-cdn.com/v4/letter/d/76d3ee/32.png) [@Diptee](https://discuss.elastic.co/u/Diptee)\
**Post date:** [April 13, 2020, 2:13pm UTC](https://discuss.elastic.co/t/unable-to-process-attachments-using-logstash-7-6-0-imap-input-plugin/227416/3 "2020-04-13T14:13:56Z")

</div>

`Thank you! @Luca_Belluccini`

---

<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:** [May 11, 2020, 2:14pm UTC](https://discuss.elastic.co/t/unable-to-process-attachments-using-logstash-7-6-0-imap-input-plugin/227416/4 "2020-05-11T14:14:02Z")

</div>

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