Git Product home page Git Product logo

Comments (6)

joeyates avatar joeyates commented on May 20, 2024

So, it looks like the 'Mail' gem is failing to parse one of the date headers of an email, and imap-backup is not handling the error.

The only solution I can see within imap-backup is to trap errors like this and log the fact that the email cannot be backed up (and maybe dump the contents of the email). I don't really like that solution as users might not see the log message and might end up relying on backups that are partial.

An alternative is to debug the failure within Mail and try to see if it needs a patch to handle the date in question. To do this we need to work out which email is causing the failure.
If you feel like 'getting you hands dirty', please do the following:

  • open the file /Users/username/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/imap-backup-1.0.9/lib/email/mboxrd/message.rb and insert the line rescue puts @body at the end of line 18, i.e.:
@parsed ||= Mail.new(@body) rescue puts @body; exit
  • rerun the backup and you should see the text of the email that's causing the failure,
  • add the email headers to this issue, or even better put them in a secret gist.

Thanks, Joe

from imap-backup.

joeyates avatar joeyates commented on May 20, 2024

Hello Martin,

were you able to pinpoint the email that was causing the problem?

from imap-backup.

martinjuhasz avatar martinjuhasz commented on May 20, 2024

so i changed the code of the mail gem to the following:

    def parsed
      begin
        @parsed ||= Mail.new(@body)
      rescue
        puts @body
        exit
      end
    end

after starting the backup, half an hour later i got an error message like this ( yay viagra spam): https://gist.github.com/martinjuhasz/49c9a8d69581ccdd068a

from imap-backup.

joeyates avatar joeyates commented on May 20, 2024

The malformed date is this: Sun, 26 Oct 2012 11:14:66 -0700 (with a seconds value of 66).

In cases like this, I think the only thing to be done is to log the problem and not backup the file.

from imap-backup.

joeyates avatar joeyates commented on May 20, 2024

I've released version 1.0.10 which skips unparsable messages. You get no backup, but you get a log message indicating message id and body.

from imap-backup.

martinjuhasz avatar martinjuhasz commented on May 20, 2024

i think thats the right decision.

from imap-backup.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.