# POP3 issues with mailpit

**URL:** <https://community.zammad.org/t/pop3-issues-with-mailpit/14629>\
**Category:** Technical assistance\
**Created:** [June 13, 2024, 6:19am UTC](https://community.zammad.org/t/pop3-issues-with-mailpit/14629 "2024-06-13T06:19:14Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![skip](https://community.zammad.org/user_avatar/community.zammad.org/skip/32/8559_2.png) [@skip](https://community.zammad.org/u/skip)\
**Post date:** [June 13, 2024, 6:19am UTC](https://community.zammad.org/t/pop3-issues-with-mailpit/14629/1 "2024-06-13T06:19:14Z")

</div>

- Used Zammad version: 6.3.1-1717572987.fd8871d4.jammy
- Used Zammad installation type: package
- Operating system: Ubuntu 22.04
- Browser + version: Firefox 126.0.1 (64-bit)

### Expected behavior:

- Be able to fetch POP3 mails from local faux mail server [Mailpit](https://github.com/axllent/mailpit)

### Actual behavior:

- Getting end of file reached when mailbox is empty  
 ![339213754-72c75f8b-176e-4dd5-9e87-9579ac689cf6](https://community.zammad.org/uploads/default/original/2X/6/655f8121cdd8f8ea3a6cc3ab2e131e9efb90f3a8.png)  
or  
`bad response: 1 %!d(float64=5836)`  
When there is a mail in the mailbox  
 ![image](https://community.zammad.org/uploads/default/original/2X/b/bd913ef61ceda90b16026b8b0edfcfb2fd7be30c.png)  
 ![image](https://community.zammad.org/uploads/default/original/2X/a/a060d1643abdf9cc7293aa2e420a4c22f8e73a96.png)

### Steps to reproduce the behavior:

- Install Mailpit on the Zammad server `sudo bash < <(curl -sL https://raw.githubusercontent.com/axllent/mailpit/develop/install.sh)`

- Create auth file for POP3  
`echo -e "user1:password1\nuser2:password2" > mailpit.auth`

- Launch mailpit with `mailpit --pop3-auth-file ./mailpit.auth`

- Set up Zammad `Email notification` account with mailpit SMTP  

- Set up Email Channel in Zammad as shown above with

Try to set up the mailbox and get the `EOF` error

- Logout from Zammad and send a `recover password` email. Receive the email in mailpit as shown above
- Try again to set up the mail channel and get the `bad response: 1 %!d(float64=5836)` error

Any pointer in the right direction is very welcome

Best,  
Skip

---

<div class="post-metadata">

**Author:** ![fliebe92](https://community.zammad.org/user_avatar/community.zammad.org/fliebe92/32/12102_2.png) [@fliebe92](https://community.zammad.org/u/fliebe92)\
**Post date:** [June 13, 2024, 11:27am UTC](https://community.zammad.org/t/pop3-issues-with-mailpit/14629/2 "2024-06-13T11:27:40Z")

</div>

Hi @skip. It seems that Mailpit is not compatible to the way how the `Net::POP3` Ruby library is fetching mails.

More technical information: [net-pop/lib/net/pop.rb at e8d0afe2773b9eb6a23c39e9e437f6fc0fc7c733 · ruby/net-pop · GitHub](https://github.com/ruby/net-pop/blob/e8d0afe2773b9eb6a23c39e9e437f6fc0fc7c733/lib/net/pop.rb#L926)

This is the line that is shown in your screenshot.

---

<div class="post-metadata">

**Author:** ![fliebe92](https://community.zammad.org/user_avatar/community.zammad.org/fliebe92/32/12102_2.png) [@fliebe92](https://community.zammad.org/u/fliebe92)\
**Post date:** [June 13, 2024, 11:30am UTC](https://community.zammad.org/t/pop3-issues-with-mailpit/14629/3 "2024-06-13T11:30:39Z")

</div>

@skip Maybe it might be a good idea to ask in the Mailpit repository for help with that, not sure though.

---

<div class="post-metadata">

**Author:** ![skip](https://community.zammad.org/user_avatar/community.zammad.org/skip/32/8559_2.png) [@skip](https://community.zammad.org/u/skip)\
**Post date:** [June 13, 2024, 1:09pm UTC](https://community.zammad.org/t/pop3-issues-with-mailpit/14629/4 "2024-06-13T13:09:15Z")

</div>

Thank you very much @fliebe92!

So far I have fixed the `bad response: 1 %!d(float64=5836)` error with this PR @ mailpit

> <https://github.com/axllent/mailpit/pull/312>
>
> This commit makes sure that LIST shows an RFC1939 compatible size
> 
> \`\`\`
> LIST
> …+OK 1 messages (5833 octets)
> 1 5833
> \`\`\`
> 
> Instead of 
> \`\`\`
> LIST
> +OK 5 messages (27300 octets)
> 1 %!d(float64=5461)
> 2 %!d(float64=5465)
> 3 %!d(float64=5350)
> 4 %!d(float64=5349)
> 5 %!d(float64=5675)
> \`\`\`
> 
> And fixes the \`float64=5461\` error of this issue https://github.com/axllent/mailpit/issues/311#issuecomment-2165453243

Now I am looking into the `end of file reached` error.

---

<div class="post-metadata">

**Author:** ![fliebe92](https://community.zammad.org/user_avatar/community.zammad.org/fliebe92/32/12102_2.png) [@fliebe92](https://community.zammad.org/u/fliebe92)\
**Post date:** [June 13, 2024, 6:32pm UTC](https://community.zammad.org/t/pop3-issues-with-mailpit/14629/5 "2024-06-13T18:32:04Z")

</div>

Hi @skip.

The `end of file reached` error comes from here: [net-pop/lib/net/pop.rb at e8d0afe2773b9eb6a23c39e9e437f6fc0fc7c733 · ruby/net-pop · GitHub](https://github.com/ruby/net-pop/blob/e8d0afe2773b9eb6a23c39e9e437f6fc0fc7c733/lib/net/pop.rb#L591-L606)

But again, I don’t know what Mailpit is doing in this case, might be worth checking RFCs how POP3 should behave in such situations etc.

---

<div class="post-metadata">

**Author:** ![skip](https://community.zammad.org/user_avatar/community.zammad.org/skip/32/8559_2.png) [@skip](https://community.zammad.org/u/skip)\
**Post date:** [June 13, 2024, 9:11pm UTC](https://community.zammad.org/t/pop3-issues-with-mailpit/14629/6 "2024-06-13T21:11:02Z")

</div>

Thanks again for pointing me in the right direction! 🤩

Added full support for POP3 to Mailpit with this commit

> <https://github.com/antonionardella/mailpit/commit/e2f28f1dd846c55b828adf276c2b669d0476ec68>

Now I was able to add the POP3 account to Zammad

 ![image](https://community.zammad.org/uploads/default/original/2X/7/74a58545e2973e8684b045a24a2d04c2121b3e1f.png)

Time for more testing and debugging now! 🤓

---

<div class="post-metadata">

**Author:** ![fliebe92](https://community.zammad.org/user_avatar/community.zammad.org/fliebe92/32/12102_2.png) [@fliebe92](https://community.zammad.org/u/fliebe92)\
**Post date:** [June 14, 2024, 8:58am UTC](https://community.zammad.org/t/pop3-issues-with-mailpit/14629/7 "2024-06-14T08:58:41Z")

</div>

Hi @skip. Do you plan to create another pull request for Mailpit with those changes? Asking for a friend… 😃

---

<div class="post-metadata">

**Author:** ![skip](https://community.zammad.org/user_avatar/community.zammad.org/skip/32/8559_2.png) [@skip](https://community.zammad.org/u/skip)\
**Post date:** [June 17, 2024, 11:02am UTC](https://community.zammad.org/t/pop3-issues-with-mailpit/14629/8 "2024-06-17T11:02:41Z")

</div>

Hello @fliebe92!

You can find the forked (and working) mailpit here:

> **[GitHub - antonionardella/mailpit: An email and SMTP testing tool with API for...](https://github.com/antonionardella/mailpit)**
>
> An email and SMTP testing tool with API for developers - antonionardella/mailpit

There is still an open discussion with the maintainer you can follow here:

> <https://github.com/axllent/mailpit/issues/311>
>
> Hello,
> 
> I am trying to set up mailpit to be used as moch email server for a st…aging installation of https://github.com/zammad/zammad according to their documentation here: https://admin-docs.zammad.org/en/latest/channels/email/index.html
> 
> This to see if the email are sent and received correctly and do further testing in a staging environment.
> 
> My issue is that once I set up mailpit and the pop3 connection parameters in zammad all I get is:
> \`end of file reached\` on Zammad's side
> 
> and \`ERRO\[2024/06/12 13:20:15\] \[pop3\] EOF\` on mailpits side.
> 
> I installed \`mkcert\` to create certificates and keys like so:
> 
> \`\`\`
> mkcert --install
> mkcert 10.0.10.52
> \`\`\`
> To generate certs for the IP of the test server
> 
> Then a pop3 auth file which contains nothing but
> \`user:pass\`
> 
> Then I start mailpit with 
> 
> \`mailpit --pop3-auth-file ./mailpit.auth --pop3-tls-cert ./cert.pem --pop3-tls-key ./key.pem\`
> 
> What else could I try to make this work or debug it?
> 
> Thanks

Once everything is clear and satisfying for all parties, it will be merged in the main project.

I hope your friend is happy for this contribution 😉

---

<div class="post-metadata">

**Author:** ![fliebe92](https://community.zammad.org/user_avatar/community.zammad.org/fliebe92/32/12102_2.png) [@fliebe92](https://community.zammad.org/u/fliebe92)\
**Post date:** [June 17, 2024, 1:20pm UTC](https://community.zammad.org/t/pop3-issues-with-mailpit/14629/9 "2024-06-17T13:20:43Z")

</div>

Hi @skip. Thanks a lot! Let me know if there is something I could support with.

---

<div class="post-metadata">

**Author:** ![skip](https://community.zammad.org/user_avatar/community.zammad.org/skip/32/8559_2.png) [@skip](https://community.zammad.org/u/skip)\
**Post date:** [June 19, 2024, 6:44am UTC](https://community.zammad.org/t/pop3-issues-with-mailpit/14629/10 "2024-06-19T06:44:41Z")

</div>

Fixed with the latest 1.18.6 release

> **[Release v1.18.6 · axllent/mailpit](https://github.com/axllent/mailpit/releases/tag/v1.18.6)**
>
> Chore
> 
> Delete multiple POP3 messages in single action
> Handle POP3 RSET command
> Update caniemail database
> Update node dependencies
> Update Go dependencies
> 
> Fix
> 
> POP3 end of file reached error (#315)
> ...

Now it works fine with Zammad

---

<div class="post-metadata">

**Author:** ![system](https://community.zammad.org/uploads/default/original/1X/5c5afaea2d23f811dbec33cd4edb02fa29d3262f.png) [@system](https://community.zammad.org/u/system)\
**Post date:** [June 26, 2024, 6:45am UTC](https://community.zammad.org/t/pop3-issues-with-mailpit/14629/11 "2024-06-26T06:45:05Z")

</div>

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