Linux (CentOS) - fetchmail and mail spool
-
I have a script put together that parses attachments out of emails and uploads them to a database. Recently, some emails that came through were not processed properly. Since the script runs unattended and my logging is not the best (is on my list of todos to fix), I want to re-process one of the problemed emails via running the script manually. Simple enough?
Well, at first, fetchmail would not retrieve the message at all since it had already "seen" it previously. I figured out that adding --fetchall would force fetchmail to re-download the message. However, even though fetchmail seems to go through the motions of retrieving the aforementioned message, it is not in the mail spool.
If I send new (unique) messages to the account the script watches, fetchmail downloads the message without issue and I see it in the mail spool.
There must be something I'm missing between fetch mail and the user's mail spool, but I'm not sure where to go next.
Any ideas?
-
Can someone change the category to "IT Discussion", pretty please? I thought that's what I selected, but obviously not.
-
@anthonyh said in Linux (CentOS) - fetchmail and mail spool:
Can someone change the category to "IT Discussion", pretty please? I thought that's what I selected, but obviously not.
Moved
-
I can't remember the lat time that I used fetchmail.
-
@scottalanmiller said in Linux (CentOS) - fetchmail and mail spool:
@anthonyh said in Linux (CentOS) - fetchmail and mail spool:
Can someone change the category to "IT Discussion", pretty please? I thought that's what I selected, but obviously not.
Moved
Thanks, @scottalanmiller!
-
@scottalanmiller said in Linux (CentOS) - fetchmail and mail spool:
I can't remember the lat time that I used fetchmail.
Well, ultimately, all I need are the messages dumped to file (one file per email). The way I'm achieving this now is by using fetchmail to dump the messages to the user's mail spool, then using formail to separate the messages into individual text files.
cat $mailSpool | formail -ds sh -c "cat > $stagingDir/msg."'$FILENO'
So, if there is a better way to approach this, perhaps in one step, I'm totally game.
-
Ha, ok, I found a workaround. I can simply cat the message back into the mail spool.
cat $msgFile >> $mailSpool
Boom, message is back in the mail spool and my process re-consumes it.