# Fetchmail can't open MDA (MDA open fails)

## dishie

I'm trying to get my mail with fetchmail. Running fetchmail -vka -m cat or -m "/usr/bin/procmail -d %T" shows that fetchmail is able to login (imap and pop), sees the messages but after reading the first messages print the error message: fetchmail: MDA open failed.

Different MDA (-m cat, -m procmail...) doensn't make a difference, as declaring the MDA in the fetchmail file. 

Only if i don't declare a mda anywhere (command line or in de config), fetchmail fails with: fetchmail: SMTP connect to localhost failed. Which is i think expected.

No message appear in the procmaillog (while procmail run successful with formail (formail -s procmail  < x.mbs)). 

And no differences between fetchmail version 6.3.9 and 6.3.9-r1 (x86).

my .fetchmailrc:

```
set postmaster saahleh

poll pop.server.eu with proto POP3 auth password user "saahleh@server.eu" there with password "pass" is saahleh here options warnings 3600
```

```
$fetchmail -v -k -m cat 

fetchmail: 6.3.9 querying pop.server.eu (protocol POP3) at Fri Feb 27 18:53:56 2009: poll started

Trying to connect to ip/110...connected.

fetchmail: POP3< +OK Hello there. <9834.1235757096@localhost.localdomain>

fetchmail: POP3> CAPA

fetchmail: POP3< +OK Here's what I can do:

fetchmail: POP3< TOP

fetchmail: POP3< USER

fetchmail: POP3< LOGIN-DELAY 10

fetchmail: POP3< PIPELINING

fetchmail: POP3< UIDL

fetchmail: POP3< IMPLEMENTATION Courier Mail Server

fetchmail: POP3< .

fetchmail: pop.server.eu: opportunistic upgrade to TLS failed, trying to continue.

fetchmail: POP3> USER saahleh@server.eu

fetchmail: POP3< +OK Password required.

fetchmail: POP3> PASS *

fetchmail: POP3< +OK logged in.

fetchmail: POP3> STAT

fetchmail: POP3< +OK 4 11796

fetchmail: POP3> LAST

fetchmail: POP3< -ERR Invalid command.

fetchmail: Invalid command.

fetchmail: POP3> UIDL

fetchmail: POP3< +OK

fetchmail: POP3< 1 1235479627.14295.server.eu

fetchmail: POP3< 2 UID2-1235479648

fetchmail: POP3< 3 UID3-1235479648

fetchmail: POP3< 4 UID4-1235479648

fetchmail: POP3< .

4 messages for saahleh@server.eu at pop.jserver.eu (11796 octets).

fetchmail: POP3> LIST 1

fetchmail: POP3< +OK 1 753

fetchmail: POP3> RETR 1

fetchmail: POP3< +OK 753 octets follow.

reading message jsaahleh@server.eupop.server.eu:1 of 4 (753 octets)

fetchmail: MDA open failed

fetchmail: POP3> QUIT

fetchmail: POP3< dfdsfsadf

fetchmail: MDA error while fetching from saahleh@server.eu@pop.server.eu

fetchmail: 6.3.9 querying pop.server.eu (protocol POP3) at Fri Feb 27 18:53:56 2009: poll completed

fetchmail: Query status=6 (IOERR)

fetchmail: normal termination, status 6

```

I don't really get it.

edit: just checking, but another server (gmail) doesn't work either...

----------

## dishie

I've got it working with getmail. Not exactly a solution but i'm receiving mail at least. Though, a real solution is appreciated.

----------

## mimosinnet

I also have had issues with fetchmail and deliver. I was getting these messages in mail.log:

```
setgid(12(mail)) failed with euid=107(fetchmail), gid=1011(fetchmail), egid=1011(fetchmail): Operation not permitted
```

This is my /etc/fetchmailrc file:

```

poll pop.gmail.com protocol POP3 service 995 

        user "username" password "password" fetchall 

        ssl

        mda "/usr/libexec/dovecot/deliver -d mailboxdestination"
```

I was getting this type message from fetchmail:

```
fetchmail: message  ningunlugar@gmail.com@ww-in-f109.1e100.net was not the expected length (4803 actual != 4693 expected)
```

I guess it is an issue with permissions. I have not been able to solve them with fetchmail, and I have also moved to getmail. This is my working configuration in ~/.getmail

```
[retriever]

type = SimplePOP3SSLRetriever

server = pop.gmail.com

port = 995

username = username

password = password

[destination]

type = MDA_external

path = /usr/libexec/dovecot/deliver

user = mail

group = mail

arguments = ("-d", "mailbox destination")

[options]

verbose = 2

delete = true

message_log = ~/.getmail/log

read_all = true
```

Basically, I have not been able to find how to set the user and group when using fetchmail.

Cheers!

----------

## tuam

procmail can't switch to another user if it's not run as root. Have you tried running fetchmail as root?

FF,

Daniel

----------

