Code Monkey home page Code Monkey logo

Comments (16)

rust avatar rust commented on June 8, 2024

こちらで検証したのですが、Subject/BodyともにISO-2022-JPで、本文が「日本」のみではエラーにはなりませんでした。

エラーを見ると、Encodingが誤って解釈されたか、来たメールのEncodingが実際とは異なるなどの問題だと思います。エラーになるメールの

  • Content-Type
  • Subject
  • 本文

を教えていただけますか。

from jpmobile.

k14a avatar k14a commented on June 8, 2024

エラーとなったメールは以下のとおりです。
ドメイン名等は変更しています。

  • Content-Type

    Content-Type: multipart/alternative;
    boundary=Apple-Mail-453BF7C8-E087-4CEB-A163-18A4B0CBB56C

  • Subject

    Subject: =?iso-2022-jp?B?RndkOiAbJEIhWhsoQk51cnNlcnlNYWlsGyRCIVtGfEZ8GyhC?=

  • 本文

    --Apple-Mail-453BF7C8-E087-4CEB-A163-18A4B0CBB56C
    Content-Transfer-Encoding: quoted-printable
    Content-Type: text/plain;
    charset=iso-2022-jp

    iPhone=1B$B$+$iAw?.=1B(B

    Begin forwarded message:

    =1B$B:9=3DP?M=1B(B: [email protected]
    =1B$BF|;~=1B(B: 2012=1B$BG/=1B(B7=1B$B7n=1B(B30=1B$BF|=1B(B 10:09:12 JST
    =1B$B08@h=1B(B: [email protected]
    =1B$B7oL>=1B(B: =1B$B!Z=1B(BNurseryMail=1B$B![F|F|=1B(B
    Reply-To: [email protected]
    =20
    =1B$BJ#?t;XDj1;y#1$/$s=1B(B =1B$B$NJ]8n<TMM=1B(B =20 =1B$BMh$k!{!{7n!{!{F|$KJ]0i1$K$F!"%9%$%+3d$jBg2q$r3+:ECW$7$^$9!#=1B(B
    =1B$B8f;22CD:$1$k>l9g$O=1B(B [email protected] =1B$B$X=1B(=B
    =1B$BIT;22C$N>l9g$O=1B(B [email protected] =1B$B$X=1B(B
    =1B$B%9%$%+$r;}$C$F$-$F$/$l$kJ}$O=1B(B [email protected] =1B$B$X=1B(B
    =1B$B%9%$%+$8$c$J$/!"%a%m%s$r;}$C$F$-$F$/$l$kJ}$O=1B(B [email protected] =1B$B$X=1B(B
    =1B$BLlGL$b;22C$7$?$$$H$$$&J}$O=1B(B [email protected] =1B=$B$X=1B(B
    =1B$B%9%$%+$K$J$C$F$/$l$k$*Ic$5$s$O=1B(B [email protected]=1B$B$X=1B(B
    =1B$B@N=3D$3XN99T$GGc$C$?LZEa$r;}$C$F$-$F$/$l$kJ}$O=1B(B [email protected] =1B$B$X=1B(B
    =1B$B$J$s$G$b$$$$$+$i;22C$7$?$$$H$$$&J}$O=1B(B [email protected] =1B$B$X=1B(B
    =1B$B0{$5$K~!9$N?M$O=1B(B [email protected] =1B$B$X=1B(B =20 =1B$B6u%a!<%k$rAw?.$/$@$5$$!#=1B(B =20 =1B$B!!!!""""J]0i1!!!y!yAH!!C4G$!!#x#x#x#x#x=1B(B

    --Apple-Mail-453BF7C8-E087-4CEB-A163-18A4B0CBB56C
    Content-Transfer-Encoding: base64
    Content-Type: text/html;
    charset=utf-8

    以下、HTMLの本文が続きます

以上、宜しくお願いしいたします。

from jpmobile.

rust avatar rust commented on June 8, 2024

d5d7802 の lib/jpmobile/util.rb への変更でこの問題は解決すると思いますが、貼りつけてもらった本文ではそもそもquoted-printable の変換が間違っている部分があるため、別のエラーになるかもしれません。

リリースは絵文字関係のオプションを追加してからになるので、必要であればパッチとしてこの変更の部分だけを取り込んでください。

from jpmobile.

k14a avatar k14a commented on June 8, 2024

上記パッチを当てて試してみたのですが、同様にEncoding::InvalidByteSequenceErrorが発生しました
もし必要でしたら、使用したメールデータを送らせて頂きます。

  • スタックトレース

    /usr/lib/ruby/gems/ruby-1.9.3-p194/gems/railties-3.2.1/lib/rails/commands/runner.rb:53:in eval': "\xE3" on ISO-2022-JP (Encoding::InvalidByteSequenceError) from /usr/lib/ruby/gems/ruby-1.9.3-p194/gems/jpmobile-3.0.4/lib/jpmobile/util.rb:146:injis_to_utf8' from
    /usr/lib/ruby/gems/ruby-1.9.3-p194/gems/jpmobile-3.0.4/lib/jpmobile/mobile/au.rb:116:in to_mail_internal' from /usr/lib/ruby/gems/ruby-1.9.3-p194/gems/jpmobile-3.0.4/lib/jpmobile/mobile/abstract_mobile.rb:160:indecode_transfer_encoding' from
    /usr/lib/ruby/gems/ruby-1.9.3-p194/gems/jpmobile-3.0.4/lib/jpmobile/mail.rb:371:in decode_transfer_encoding' from /usr/lib/ruby/gems/ruby-1.9.3-p194/gems/jpmobile-3.0.4/lib/jpmobile/mail.rb:123:inprocess_body_raw_with_jpmobile' from
    /usr/lib/ruby/gems/ruby-1.9.3-p194/gems/mail-2.4.4/lib/mail/message.rb:1155:in body' from /usr/lib/ruby/gems/ruby-1.9.3-p194/gems/jpmobile-3.0.4/lib/jpmobile/mail.rb:358:inblock in mobile=' from
    /usr/lib/ruby/gems/ruby-1.9.3-p194/gems/jpmobile-3.0.4/lib/jpmobile/mail.rb:355:in each' from /usr/lib/ruby/gems/ruby-1.9.3-p194/gems/jpmobile-3.0.4/lib/jpmobile/mail.rb:355:inmobile=' from
    /usr/lib/ruby/gems/ruby-1.9.3-p194/gems/jpmobile-3.0.4/lib/jpmobile/mail.rb:118:in process_body_raw_with_jpmobile' from /usr/lib/ruby/gems/ruby-1.9.3-p194/gems/mail-2.4.4/lib/mail/message.rb:1155:inbody' from
    /usr/lib/ruby/gems/ruby-1.9.3-p194/gems/mail-2.4.4/lib/mail/message.rb:1934:in identify_and_set_transfer_encoding' from /usr/lib/ruby/gems/ruby-1.9.3-p194/gems/mail-2.4.4/lib/mail/message.rb:1689:inready_to_send!' from
    /usr/lib/ruby/gems/ruby-1.9.3-p194/gems/jpmobile-3.0.4/lib/jpmobile/mail.rb:65:in encoded_with_jpmobile' from /usr/lib/ruby/gems/ruby-1.9.3-p194/gems/actionmailer-3.2.1/lib/action_mailer/base.rb:435:inset_payload_for_mail' from
    /usr/lib/ruby/gems/ruby-1.9.3-p194/gems/jpmobile-3.0.4/lib/jpmobile/mailer.rb:42:in set_payload_for_mail' from /usr/lib/ruby/gems/ruby-1.9.3-p194/gems/actionmailer-3.2.1/lib/action_mailer/base.rb:404:inblock in receive' from
    /usr/lib/ruby/gems/ruby-1.9.3-p194/gems/activesupport-3.2.1/lib/active_support/notifications.rb:123:in block in instrument' from /usr/lib/ruby/gems/ruby-1.9.3-p194/gems/activesupport-3.2.1/lib/active_support/notifications/instrumenter.rb:20:ininstrument' from
    /usr/lib/ruby/gems/ruby-1.9.3-p194/gems/activesupport-3.2.1/lib/active_support/notifications.rb:123:in instrument' from /usr/lib/ruby/gems/ruby-1.9.3-p194/gems/actionmailer-3.2.1/lib/action_mailer/base.rb:402:inreceive' from (eval):1:in <top (required)>' from /usr/lib/ruby/gems/ruby-1.9.3-p194/gems/railties-3.2.1/lib/rails/commands/runner.rb:53:ineval' from
    /usr/lib/ruby/gems/ruby-1.9.3-p194/gems/railties-3.2.1/lib/rails/commands/runner.rb:53:in <top (required)>' from /usr/lib/ruby/gems/ruby-1.9.3-p194/gems/railties-3.2.1/lib/rails/commands.rb:64:inrequire' from
    /usr/lib/ruby/gems/ruby-1.9.3-p194/gems/railties-3.2.1/lib/rails/commands.rb:64:in <top (required)>' from script/rails:6:inrequire' from script/rails:6:in `

    '

宜しくお願いいたします。

from jpmobile.

rust avatar rust commented on June 8, 2024

ここに貼り付けていただいたメールのデータですが、=1B(=Bのようにそもそも不正なデータになっていたので、decode時にエラーになってしまうようです。よろしければメールデータをtarとかzipで圧縮して送っていただけますか?

とは言え、そういう不正なメールが来ないとも限らないので、どこかでrescueしてASCII-8BITで返す必要があるとは思ってますので、そちらはそちらで対処予定です。

from jpmobile.

rust avatar rust commented on June 8, 2024

現象を確認しました。ただ結構根深そうなので、すぐには修正できそうにありません。もう少々お待ちください。

from jpmobile.

rust avatar rust commented on June 8, 2024

742f2a3 で受信時のエラーは大丈夫そうですので、一度試してみていただけますか。

from jpmobile.

k14a avatar k14a commented on June 8, 2024

受信エラーが無くなりました。
もう少しいろんなパターンで試してみたいと思います。
ありがとうございました。

from jpmobile.

k14a avatar k14a commented on June 8, 2024

au版iPhoneのMessageアプリでエラーになってしまいました。

/usr/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/commands/runner.rb:53:in `eval': "\xE7" on ISO-2022-JP (Encoding::InvalidByteSequenceError)  from
/usr/lib/ruby/gems/1.9.1/gems/jpmobile-3.0.4/lib/jpmobile/util.rb:148:in `jis_to_utf8'

送信したメールは以下のとおりです

Subject:=?UTF-8?B?aVBob25lIGF1IOODoeODg+OCu+ODvOOCuA==?=
Message-ID: <212212358846052174@-212212358846052175>
Date: Tue, 22 Aug 2012 01:27:26 +0000
MIME-Version:1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: base64

JVvlnJLlhZDlkI1dJeOBriVb5L+d6K236ICF5ZCNXSUg5qeYCgrmlr3oqK3jgavpgIHkv6HjgIIK
6YG45oqeMeOBryVb44Ki44OJ44Os44K5MV0l44G4CumBuOaKnjLjga8lW+OCouODieODrOOCuTJd
JeOBuArov5Tkv6HjgZfjgabkuIvjgZXjgYTjgIIKCmlQaG9uZSBhdSDjg6Hjg4Pjgrvjg7zjgrg=

宜しくお願いいたします。

from jpmobile.

rust avatar rust commented on June 8, 2024

runnerの実行時のエラーのようですが、メールの受信か送信かのどちらでしょうか。おそらく受信だとは思うのですが、受信時のエラーでしょうか。

上記のメールをそのまま受信->送信ではエラーにはなりませんでした。

from jpmobile.

k14a avatar k14a commented on June 8, 2024

メール受信時にエラーとなります。
上で貼った部分だけを受信させるとエラーになりませんが、メールヘッダを含めて受信させるとエラーになりました。
メール全文を別途送らせて頂きます。

from jpmobile.

rust avatar rust commented on June 8, 2024

68fbf6e で送ってもらったメールがうまく処理できるように修正しました。こちらでどうでしょうか。

from jpmobile.

k14a avatar k14a commented on June 8, 2024

受信できるようになりました。
ありがとうございました。

from jpmobile.

k14a avatar k14a commented on June 8, 2024

また受信時にエラーとなるパターンがでました。
メールにてエラーとなったものを送らせてもらいます。
よろしくお願いします。

from jpmobile.

rust avatar rust commented on June 8, 2024

どんなエラーになりましたか?

from jpmobile.

rust avatar rust commented on June 8, 2024

あと同じissueではないので、別のチケットとしてください。そのときにbacktraceもお願いします。

from jpmobile.

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.