ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Linux (CentOS) - fetchmail and mail spool

    IT Discussion
    fetchmail email
    2
    7
    1.0k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • anthonyhA
      anthonyh
      last edited by scottalanmiller

      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?

      1 Reply Last reply Reply Quote 0
      • anthonyhA
        anthonyh
        last edited by anthonyh

        Can someone change the category to "IT Discussion", pretty please? I thought that's what I selected, but obviously not.

        scottalanmillerS 1 Reply Last reply Reply Quote 1
        • scottalanmillerS
          scottalanmiller @anthonyh
          last edited by

          @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

          anthonyhA 1 Reply Last reply Reply Quote 1
          • scottalanmillerS
            scottalanmiller
            last edited by

            I can't remember the lat time that I used fetchmail.

            anthonyhA 1 Reply Last reply Reply Quote 0
            • anthonyhA
              anthonyh @scottalanmiller
              last edited by

              @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!

              1 Reply Last reply Reply Quote 0
              • anthonyhA
                anthonyh @scottalanmiller
                last edited by

                @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.

                1 Reply Last reply Reply Quote 0
                • anthonyhA
                  anthonyh
                  last edited by anthonyh

                  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.

                  1 Reply Last reply Reply Quote 1
                  • 1 / 1
                  • First post
                    Last post