rb-sisimai icon indicating copy to clipboard operation
rb-sisimai copied to clipboard

[Feature Request] Is it possible to create single parsed JSON file?

Open hiroyuki-sato opened this issue 9 years ago • 2 comments

Is it possible to create single parsed JSON file? If not, please add those methods.

I would like to create JSON object per mails.

Example.

https://github.com/hiroyuki-sato/embulk-parser-sisimai_analyzer/blob/master/lib/embulk/parser/sisimai_analyzer.rb#L33

{"subject":"キジトラ","replycode":"550","action":"failed","lhost":"192.0.2.31","diagnosticcode":"550 Unknown user [email protected]","timestamp":1240874268,"deliverystatus":"5.1.1","addresser":"[email protected]","smtpcommand":"DATA","reason":"userunknown","smtpagent":"Sendmail","alias":"","recipient":"[email protected]","token":"1e86ae85ee6075211a5cb514c312c5a89193268d","feedbacktype":"","softbounce":0,"rhost":"mfsmax.docomo.ne.jp","listid":"","messageid":"[email protected]","diagnostictype":"SMTP","destination":"docomo.ne.jp","timezoneoffset":"+0900","senderdomain":"example.jp"}
{"subject":"キジトラ","replycode":"550","action":"failed","lhost":"192.0.2.97","diagnosticcode":"550 Host unknown","timestamp":1221728044,"deliverystatus":"5.1.2","addresser":"[email protected]","smtpcommand":"","reason":"hostunknown","smtpagent":"Sendmail","alias":"","recipient":"[email protected]","token":"d059e55e074333fe59001b1d30d27da85a1a9c1d","feedbacktype":"","softbounce":0,"rhost":"example.gov","listid":"","messageid":"AA406E7E18714AB2927DAACC24B47C4A@USER-PC97","diagnostictype":"SMTP","destination":"example.gov","timezoneoffset":"+0900","senderdomain":"example.jp"}

hiroyuki-sato avatar Jan 27 '16 09:01 hiroyuki-sato

@hiroyuki-sato Sisimai.make() method always return parsed results as Array. Because the number of bounces in a single email file is NOT always limited to one.

For example, https://github.com/sisimai/set-of-emails/blob/master/maildir/bsd/postfix-02.eml, https://github.com/sisimai/set-of-emails/blob/master/maildir/bsd/sendmail-02.eml, and https://github.com/sisimai/set-of-emails/blob/master/maildir/bsd/qmail-02.eml are including 2 or more bounce records in a email file.

Therefore, Sisima.make() method always return the results as an Array if there is only one bounce record in a email file.

azumakuniyuki avatar Jan 27 '16 10:01 azumakuniyuki

I see, Thanks!.

hiroyuki-sato avatar Jan 27 '16 10:01 hiroyuki-sato

@azumakuniyuki I've forgotten to close this issue. Thanks!

hiroyuki-sato avatar Mar 14 '24 10:03 hiroyuki-sato