So I set up fetchmail to retrieve emails with IMAP from a remote mail server, I was able to run it. How can I know that it found any emails or not since I did send test emails to the account being polled and haven't read them so that they can be detected by fetchmail. Another issue is that I am not sure that fetchmail is handing them over to my MTA which is postfix in this case.

How can I be sure this is happening and where do I find the emails retrieved?


There are options you can use when you call fetchmail that will make it print out logs and debug information. Here's from the man page:

 For troubleshooting, tracing and debugging, you need to increase fetch-
 mail's verbosity to actually see what happens. To do that,  please  run
 both  of  the  two  following commands, adding all of the options you'd
 normally use.

 env LC_ALL=C fetchmail -V -v --nodetach --nosyslog

 (This command line prints in English how  fetchmail  understands
 your configuration.)

 env LC_ALL=C fetchmail -vvv  --nodetach --nosyslog

 (This  command line actually runs fetchmail with verbose English

If fetchmail does run and fetch your email and hand it over to your local MTA, you should also be able to find traces of this in /var/log/maillog (or wherever you've told your system to place your mail logs).


Apart from Jenny's answer allowing you to watch over fetchmail's shoulder. A good indication that the emails got retrieved if if they are no longer on the IMAP server. To check that you can connect with an IMAP client, or look into the Mail directory on the server ( e.g. ~/Maildir).

On the client side fetchmail probably stores mails in /var/spool/mail, unless you have set up your MTA. to deliver e.g. via procmail, in the later case your recipients ~/.procmailrc determines where things go.

If you cannot seem to trace where things are going. Check your mail log (in fetched emails get bounced). As a last resort you can also touch a file ( '/var/tmp/now', run fetchmail and use find / -newer /var/tmp/now to search for recently created/updated files on the system.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.