Search code examples
urlencode

GNU mailutils: How to encode '@' and '$' in mailbox patterns


I am trying to access a remote mail server and output the number of messages in a mailbox using the mailutils program messages.

I run the program from a shell with:

messages --config-file=/path/to/file/mailutils.cfg

where mailutils.cfg contains

mailbox {
  mailbox-pattern imaps://[email protected]:[email protected]/INBOX;
}

and [email protected] is a user name that cannot be altered and pass$word is a password that cannot be altered either.

I am geting a German error message which translated to English would be something like:

messages: mailbox could not be created: port and service invalid

When I run the program on an imap mailbox (not imaps) for an easier user/password combination everything works fine. So I conclude mailutils does not like the '$' in the password and/or the '@' in the user name.

When I run messages for a user [email protected] with a simple password abcd using the '%40' encoding for the @ sign

mailbox {
  mailbox-pattern imaps://xxx%40yyy.de:[email protected]/INBOX;
}

I get the error message 'verstreutes Zeichen %' which probably means something like 'found infeasible character %'.

So: how to encode '@' and '$' in mailutils? I may be blind but the manual does not tell how do solve this problem.


Solution

  • Simple, put the pattern into double quotes (Gänsefüßchen)

    mailbox-pattern "imaps://xxx%40yyy.de:[email protected]/INBOX";