1

I want to download emails without any processing, without procmail. I'm trying to configure fetchmail like this:

mda "/bin/sh -c 'cat > INBOX/new/$(date +%s_%N)'"

But it resulted in a file named "yuchao_326621000", but not the expected "1428556930_751589889". I think this is because fetchmail will replace "%s" with the current user name.

So, how do I encode a '%' in the "mda" option?

What I have tried:

mda "/bin/sh -c 'cat > INBOX/new/$(date +%%s_%N)'"

mda "/bin/sh -c 'cat > INBOX/new/$(date +\%s_\%N)'"

Both of the above don't work.

heiz
  • 1,803

1 Answers1

1

After reading fetchmail's source code (sink.c, around line 1183), I couldn't figure out a way to encode '%'.

So the only work-around is to avoid "%s", and it's easy by using bash's single quote syntax:

mda "/bin/sh -c 'cat > INBOX/new/$(date +%''s_%N)'"
heiz
  • 1,803