email_parser_test.rb 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580
  1. # encoding: utf-8
  2. require 'test_helper'
  3. class EmailParserTest < ActiveSupport::TestCase
  4. test 'parse' do
  5. files = [
  6. {
  7. :data => IO.read('test/fixtures/mail1.box'),
  8. :body_md5 => 'b57d21dcac6b05e1aa67af51a9e4c1ec',
  9. :params => {
  10. :from => 'John.Smith@example.com',
  11. :from_email => 'John.Smith@example.com',
  12. :from_display_name => '',
  13. :subject => 'CI Daten für PublicView ',
  14. },
  15. },
  16. {
  17. :data => IO.read('test/fixtures/mail2.box'),
  18. :body_md5 => '154c7d3ae7b94f99589df62882841b08',
  19. :params => {
  20. :from => 'Martin Edenhofer <martin@example.com>',
  21. :from_email => 'martin@example.com',
  22. :from_display_name => 'Martin Edenhofer',
  23. :subject => 'aaäöüßad asd',
  24. :body_md5 => "äöüß ad asd\n\n-Martin\n\n--\nOld programmers never die. They just branch to a new address.\n",
  25. :body => "äöüß ad asd
  26. -Martin
  27. --
  28. Old programmers never die. They just branch to a new address.
  29. "
  30. },
  31. },
  32. {
  33. :data => IO.read('test/fixtures/mail3.box'),
  34. :body_md5 => '96a0a7847c1c60e82058db8f8bff8136',
  35. :params => {
  36. :from => '"Günther John | Example GmbH" <k.guenther@example.com>',
  37. :from_email => 'k.guenther@example.com',
  38. :from_display_name => 'Günther John | Example GmbH',
  39. :subject => 'Ticket Templates',
  40. },
  41. },
  42. {
  43. :data => IO.read('test/fixtures/mail4.box'),
  44. :body_md5 => '2f2c3a5c233dbd9658ab37d39469b7d0',
  45. :params => {
  46. :from => '"Günther Katja | Example GmbH" <k.guenther@example.com>',
  47. :from_email => 'k.guenther@example.com',
  48. :from_display_name => 'Günther Katja | Example GmbH',
  49. :subject => 'AW: Ticket Templates [Ticket#11168]',
  50. :body_md5 => "Hallo Katja,
  51. super! Ich freu mich!
  52. Wir würden gerne die Präsentation/Einführung in die Ticket Templates per Screensharing oder zumindest per Telefon machen.
  53. Mögliche Termine:
  54. o Do, 10.05.2012 15:00-16:00
  55. o Fr, 11.05.2012 13:00-14:00
  56. o Di, 15.05.2012 17:00-18:00
  57. Über Feedback würde ich mich freuen!
  58. PS: Zur besseren Übersicht habe ich ein Ticket erstellt. :) Im Footer sind unsere geschäftlichen Kontaktdaten (falls diese irgendwann einmal benötigt werden sollten), mehr dazu in ein paar Tagen.
  59. Liebe Grüße!
  60. -Martin
  61. ",
  62. },
  63. },
  64. {
  65. :data => IO.read('test/fixtures/mail5.box'),
  66. :body_md5 => 'f34033e9a34bb5367062dd5df21115df',
  67. :params => {
  68. :from => 'marc.smith@example.com (Marc Smith)',
  69. :from_email => 'marc.smith@example.com',
  70. :from_display_name => 'Marc Smith',
  71. :subject => 'Re: XXXX Betatest Ticket Templates [Ticket#11162]',
  72. },
  73. },
  74. {
  75. :data => IO.read('test/fixtures/mail6.box'),
  76. :body_md5 => '88c0c9e004021a4ed2a0c1e5f6b3455d',
  77. :params => {
  78. :from => '"Hans BÄKOSchönland" <me@bogen.net>',
  79. :from_email => 'me@bogen.net',
  80. :from_display_name => 'Hans BÄKOSchönland',
  81. :subject => 'utf8: 使って / ISO-8859-1: Priorität" / cp-1251: Сергей Углицких',
  82. :body => "this is a test [1]Compare Cable, DSL or Satellite plans: As low as $2.95.
  83. Test1:8
  84. Test2:&
  85. Test3:&ni;
  86. Test4:&
  87. Test5:=
  88. [1] http://localhost/8HMZENUS/2737??PS=
  89. "
  90. },
  91. },
  92. {
  93. :data => IO.read('test/fixtures/mail7.box'),
  94. :body_md5 => '6029e6b6106a6dd11ed887ec31f118ac',
  95. :params => {
  96. :from => 'Eike.Ehringer@example.com',
  97. :from_email => 'Eike.Ehringer@example.com',
  98. :from_display_name => '',
  99. :subject => 'AW:Installation [Ticket#11392]',
  100. :body_md5 => "Hallo.
  101. Jetzt muss ich dir noch kurzfristig absagen für morgen.
  102. Lass uns evtl morgen Tel.
  103. Mfg eike
  104. Martin Edenhofer via Znuny Team --- Installation [Ticket#11392] ---
  105. Von:\"Martin Edenhofer via Znuny Team\" <support@example.com>Aneike.xx@xx-corpxx.comDatum:Mi., 13.06.2012 14:30BetreffInstallation [Ticket#11392]
  106. Hi Eike,
  107. anbei wie gestern telefonisch besprochen Informationen zur Vorbereitung.
  108. a) Installation von http://ftp.gwdg.de/pub/misc/zammad/RPMS/fedora/4/zammad-3.0.13-01.noarch.rpm (dieses RPM ist RHEL kompatible) und dessen Abhängigkeiten.
  109. b) Installation von \"mysqld\" und \"perl-DBD-MySQL\".
  110. Das wäre es zur Vorbereitung!
  111. Bei Fragen nur zu!
  112. -Martin
  113. --
  114. Martin Edenhofer
  115. Znuny GmbH // Marienstraße 11 // 10117 Berlin // Germany
  116. P: +49 (0) 30 60 98 54 18-0
  117. F: +49 (0) 30 60 98 54 18-8
  118. W: http://example.com
  119. Location: Berlin - HRB 139852 B Amtsgericht Berlin-Charlottenburg
  120. Managing Director: Martin Edenhofer
  121. ",
  122. },
  123. },
  124. {
  125. :data => IO.read('test/fixtures/mail8.box'),
  126. :body_md5 => 'ca502c70a1b006f5184d1f0bf79d5799',
  127. :attachments => [
  128. {
  129. :md5 => 'c3ca4aab222eed8a148a716371b70129',
  130. :filename => 'message.html',
  131. },
  132. ],
  133. :params => {
  134. :from => 'Franz.Schaefer@example.com',
  135. :from_email => 'Franz.Schaefer@example.com',
  136. :from_display_name => '',
  137. :subject => 'could not rename: ZZZAAuto',
  138. :body_md5 => "Gravierend?
  139. Mit freundlichen Grüßen
  140. Franz Schäfer
  141. Manager Information Systems
  142. Telefon
  143. +49 000 000 8565
  144. franz.schaefer@example.com
  145. Example Stoff GmbH
  146. Fakultaet
  147. Düsseldorfer Landstraße 395
  148. D-00000 Hof
  149. www.example.com
  150. Geschäftsführung/Management Board: Jan Bauer (Vorsitzender/Chairman),
  151. Oliver Bauer, Heiko Bauer, Boudewijn Bauer
  152. Sitz der Gesellschaft / Registered Office: Hof
  153. Registergericht / Commercial Register of the Local Court: HRB 0000 AG
  154. Hof
  155. ",
  156. },
  157. },
  158. {
  159. :data => IO.read('test/fixtures/mail9.box'),
  160. :body_md5 => 'c70de14cc69b17b07850b570d7a4fbe7',
  161. :attachments => [
  162. {
  163. :md5 => '9964263c167ab47f8ec59c48e57cb905',
  164. :filename => 'message.html',
  165. },
  166. {
  167. :md5 => 'ddbdf67aa2f5c60c294008a54d57082b',
  168. :filename => 'super-seven.jpg',
  169. },
  170. ],
  171. :params => {
  172. :from => 'Martin Edenhofer <martin@example.de>',
  173. :from_email => 'martin@example.de',
  174. :from_display_name => 'Martin Edenhofer',
  175. :subject => 'AW: OTRS / Anfrage OTRS Einführung/Präsentation [Ticket#11545]',
  176. :body => "Enjoy!\n\n-Martin\n\n--\nOld programmers never die. They just branch to a new address.\n\n"
  177. },
  178. },
  179. {
  180. :data => IO.read('test/fixtures/mail10.box'),
  181. :body_md5 => 'ddfad696bd34d83f607763180243f3c5',
  182. :attachments => [
  183. {
  184. :md5 => '52d946fdf1a9304d0799cceb2fcf0e36',
  185. :filename => 'message.html',
  186. },
  187. {
  188. :md5 => 'a618d671348735744d4c9a4005b56799',
  189. :filename => 'image001.jpg',
  190. },
  191. ],
  192. :params => {
  193. :from => 'Smith Sepp <smith@example.com>',
  194. :from_email => 'smith@example.com',
  195. :from_display_name => 'Smith Sepp',
  196. :subject => 'Gruß aus Oberalteich',
  197. # :body => "Herzliche Grüße aus Oberalteich sendet Herrn Smith\n\n \n\nSepp Smith - Dipl.Ing. agr. (FH)\n\nGeschäftsführer der example Straubing-Bogen\n\nKlosterhof 1 | 94327 Bogen-Oberalteich\n\nTel: 09422-505601 | Fax: 09422-505620\n\nInternet: http://example-straubing-bogen.de <http://example-straubing-bogen.de/> \n\nFacebook: http://facebook.de/examplesrbog <http://facebook.de/examplesrbog> \n\n - European Foundation für Quality Management\n\n"
  198. },
  199. },
  200. {
  201. :data => IO.read('test/fixtures/mail11.box'),
  202. :body_md5 => 'cf8b26d9fc4ce9abb19a36ce3a130c79',
  203. :attachments => [
  204. {
  205. :md5 => '08660cd33ce8c64b95bcf0207ff6c4d6',
  206. :filename => 'message.html',
  207. },
  208. ],
  209. :params => {
  210. :from => 'CYLEX Newsletter <carina.merkant@cylex.de>',
  211. :from_email => 'carina.merkant@cylex.de',
  212. :from_display_name => 'CYLEX Newsletter',
  213. :subject => 'Eine schöne Adventszeit für ZNUNY GMBH - ENTERPRISE SERVICES FÜR OTRS',
  214. :to => 'enjoy_us@znuny.com',
  215. },
  216. },
  217. {
  218. :data => IO.read('test/fixtures/mail12.box'),
  219. :body_md5 => '8b48e082bc77e927d395448875259172',
  220. :attachments => [
  221. {
  222. :md5 => '46cf0f95ea0c8211cbb704e1959b9173',
  223. :filename => 'message.html',
  224. },
  225. {
  226. :md5 => 'b6e70f587c4b1810facbb20bb5ec69ef',
  227. :filename => 'image002.png',
  228. },
  229. ],
  230. :params => {
  231. :from => 'Alex.Smith@example.com',
  232. :from_email => 'Alex.Smith@example.com',
  233. :from_display_name => '',
  234. :subject => 'AW: Agenda [Ticket#11995]',
  235. :to => 'example@znuny.com',
  236. },
  237. },
  238. {
  239. :data => IO.read('test/fixtures/mail13.box'),
  240. :body_md5 => '58806e006b14b04a535784a5462d09b0',
  241. :attachments => [
  242. {
  243. :md5 => '29cc1679f8a44c72be6be7c1da4278ac',
  244. :filename => 'message.html',
  245. },
  246. ],
  247. :params => {
  248. :from => 'thomas.smith@example.com',
  249. :from_email => 'thomas.smith@example.com',
  250. :from_display_name => '',
  251. :subject => 'Antwort: Probleme ADB / Anlegen von Tickets [Ticket#111079]',
  252. :to => 'q1@znuny.com',
  253. },
  254. },
  255. {
  256. :data => IO.read('test/fixtures/mail14.box'),
  257. :body_md5 => '154c7d3ae7b94f99589df62882841b08',
  258. :attachments => [
  259. {
  260. :md5 => '5536be23f647953dc39c1673205d6f5b',
  261. :filename => 'file-1',
  262. },
  263. {
  264. :md5 => '4eeeae078b920f9d0708353ba0f6aa63',
  265. :filename => 'file-2',
  266. },
  267. ],
  268. :params => {
  269. :from => '"Müller, Bernd" <Bernd.Mueller@example.com>',
  270. :from_email => 'Bernd.Mueller@example.com',
  271. :from_display_name => "Müller, Bernd",
  272. :subject => 'AW: OTRS [Ticket#118192]',
  273. :to => '\'Martin Edenhofer via Znuny Sales\' <sales@znuny.com>',
  274. },
  275. },
  276. # spam email
  277. {
  278. :data => IO.read('test/fixtures/mail15.box'),
  279. :body_md5 => 'd41d8cd98f00b204e9800998ecf8427e',
  280. :attachments => [
  281. # :preferences=>{"Message-ID"=>"<temp@test>", "Content-Type"=>"application/octet-stream; name=\"\xBC\xA8\xD0\xA7\xB9\xDC\xC0\xED,\xBE\xBF\xBE\xB9\xCB\xAD\xB4\xED\xC1\xCB.xls\"", "Mime-Type"=>"application/octet-stream", "Charset"=>"UTF-8"}}
  282. # mutt c1abb5fb77a9d2ab2017749a7987c074
  283. {
  284. :md5 => '2ef81e47872d42efce7ef34bfa2de043',
  285. :filename => 'file-1',
  286. },
  287. ],
  288. :params => {
  289. :from => '"Sara.Gang" <ynbe.ctrhk@gmail.com>',
  290. :from_email => 'ynbe.ctrhk@gmail.com',
  291. :from_display_name => "Sara.Gang",
  292. :subject => '绩效管理,究竟谁错了',
  293. :to => 'info42@znuny.com',
  294. },
  295. },
  296. # spam email
  297. {
  298. :data => IO.read('test/fixtures/mail16.box'),
  299. :body_md5 => 'b255fb5620db3b63131924513061d974',
  300. :params => {
  301. :from => nil,
  302. :from_email => 'vipyimin@126.com',
  303. :from_display_name => "",
  304. :subject => '【 直通美国排名第49大学 成功后付费 】',
  305. :to => '"enterprisemobility.apacservice" <enterprisemobility.apacservice@motorola.com>',
  306. },
  307. },
  308. # spam email
  309. {
  310. :data => IO.read('test/fixtures/mail17.box'),
  311. :body_md5 => 'c32d6502f47435e613a2112625118270',
  312. :params => {
  313. :from => '"都琹" <ghgbwum@185.com.cn>',
  314. :from_email => 'ghgbwum@185.com.cn',
  315. :from_display_name => "都琹",
  316. :subject => '【专业为您注册香港及海外公司(好处多多)】                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               人物 互联网事百度新闻独家出品传媒换一批捷克戴维斯杯决赛前任命临时领队 前领队因病住院最新:盖世汽车讯 11月6日,通用汽车宣布今年10月份在华销量...减持三特索道 孟凯将全力发展湘鄂情江青摄影作品科技日报讯 (记者过国忠 通讯员陈飞燕)江苏省无线电科学研究所有限公司院士工作站日前正式建...[详细]',
  317. :to => 'info@znuny.com',
  318. },
  319. },
  320. {
  321. :data => IO.read('test/fixtures/mail18.box'),
  322. :body_md5 => '66f20e8557095762ccad9a6cb6f59c3a',
  323. :params => {
  324. :from => 'postmaster@example.com',
  325. :from_email => 'postmaster@example.com',
  326. :from_display_name => '',
  327. :subject => 'Benachrichtung zum =?unicode-1-1-utf-7?Q?+ANw-bermittlungsstatus (Fehlgeschlagen)?=',
  328. :to => 'sales@znuny.org',
  329. },
  330. },
  331. {
  332. :data => IO.read('test/fixtures/mail19.box'),
  333. :body_md5 => '2fa47e9122f4c1b9c5057400529c7567',
  334. :params => {
  335. :from => '"我" <>',
  336. :from_email => '"=?GB2312?B?ztI=?=" <>',
  337. :from_display_name => '',
  338. :subject => '《欧美简讯》',
  339. :to => '377861373 <377861373@qq.com>',
  340. },
  341. },
  342. {
  343. :data => IO.read('test/fixtures/mail20.box'),
  344. :body_md5 => 'd2b65203aaf2bbbd50fc73cb14d781bc',
  345. :params => {
  346. :from => 'Health and Care-Mall <drugs-cheapest8@sicor.com>',
  347. :from_email => 'drugs-cheapest8@sicor.com',
  348. :from_display_name => 'Health and Care-Mall',
  349. :subject => 'The Highest Grade Drugs And EXTRA LOW Price .',
  350. :to => 'info2@znuny.com',
  351. :body => "________________________________________________________________________Yeah but even when they. Beth liî ed her neck as well
  352. &oacute;25aHw511I&Psi;11xG&lfloor;o8KHCm&sigmaf;9-2&frac12;23Qg&ntilde;V6UAD12AX&larr;t1Lf7&oplus;1Ir&sup2;r1TLA5pYJhjV gPn&atilde;M36V1E89RUD&Tau;&Aring;12I92s2C&Theta;YE&upsih;Afg&lowast;bT11&int;rIoi&scaron;&brvbar;O5oUIN1Is2S21Pp &Yuml;2q1F&Chi;&uArr;eGOz&lceil;F1R98y&sect; 74&rdquo;lTr8r1H2&aelig;u2E2P2q VmkfB&int;SKNElst4S&exist;182T2G1&iacute; lY92Pu&times;8>R&Ograve;&not;&oplus;&Mu;I&Ugrave;z&Ugrave;CC412QE&Rho;&ordm;S2!Xg&OElig;s.
  353. 2&gamma;&dArr;B[1]cwspC&ensp;L8I&nbsp;C&nbsp;K88H E1R?E2e31 !Calm dylan for school today.
  354. Closing the nursery with you down. Here and made the mess. Maybe the oï from under his mother. Song of course beth touched his pants.
  355. When someone who gave up from here. Feel of god knows what.
  356. TB&piv;&exist;M5T5&Epsilon;Ef2&ucirc;&ndash;N&para;1v&Zeta;'1&dArr;&prop;5S2225 &Chi;0j&Delta;HbAg&thorn;E&mdash;2i6A2lD&uArr;LGj2nTOy11H2&tau;9&rsquo;:Their mother and tugged it seemed like
  357. d3RsV&para;H2&Theta;i&macr;B&part;gax1b&icirc;gdH23r2J&yuml;1aIK1&sup2; n1jfaTk1Vs3952 C&tilde;lBl&lsquo;mxGo0&radic;2XwT8Ya 28ksa&int;f1&alefsym;s&rdquo;62Q 2Ad7$p32d1e&prod;2e.0&rdquo;261a2&Kappa;63&alpha;SM2
  358. Nf52CdL&cup;1i&harr;xcaa52R3l6Lc3i2z16s&oacute;9&egrave;U zDE1aE21gs25&Euml;2 hE1cl&sup;&cent;11o21&micro;Bw1zF1 q2k&otilde;aXUius1r0&sube; d&bull;&isin;2$1Z2F1218l.07d56P&Uacute;l25JAO6
  359. 45loV2iv1i2&atilde;&Upsilon;&lfloor;a2&sup;d2g&Atilde;&Upsilon;3&trade;r22u&cedil;aWjO8 n40&ndash;Soy&egrave;2u1&empty;23p1J&Mu;Ne&Igrave;22jr&aacute;2r&Kappa; 1229A2rAkc8nuEtl22ai&Dagger;OB8vSb&eacute;&sigma;e&iota;&otilde;q1+65cw 2s8Ua&ograve;4PrsE1y8 &lang;fMElh&upsih;&sdot;Jo8pmzwj&circ;N1 wv39aW1WtsvuU3 1a&oelig;1$2&Nu;nR2O2&rceil;B.&forall;2c&rarr;5&Ecirc;9&chi;w5p1&frasl;N
  360. fHGFVfE&sup3;2i&sigma;jGpa51kgg12cWrUq52akx2h 0F24P&cedil;2L2rn22&Iuml;o2&Yacute;2HfoRb2eU&alpha;w6s2N&oline;ws&para;13&Beta;i2X1&cedil;ofgtHnR&perp;32ase92lF1H5 26B1a&sup;2i&upsih;s&ocirc;12i &Aring;kMyl2J1&Auml;oQ&ndash;0&image;wvm&ugrave;2 2&circ;&mu;\"aQ7jVse62f 1h2p$L2r&pound;3i1t2.323h5qP8g0&hearts;&divide;R2
  361. &middot;i&fnof;PV1&Beta;&ni;&oslash;iF1R1a4v32gL9&cent;wr1722a2&ucirc;0&eta; &thorn;12&szlig;Stu21u7&aacute;&iexcl;lp2ocEe1SLlrV2Xj &perp;U&micro;1F&not;48&eth;ov71Arm242c2Vw2e1&sect;&supe;N 1242aL&thorn;Z2ski&times;5 c&euro;pBl&ucirc;26&part;ol1f&Uacute;wK&szlig;32 4i2la4C12sRE21 &atilde;eI2$2z8t442fG.&cedil;1&le;12F&rsquo;&Atilde;152in&nsub;
  362. Tl1&euml;C2v7Ci71X8a225Nl&thorn;U&rang;&iota;icO&sum;&laquo;s&middot;iKN Uu&upsih;jS1j52u2J&uuml;&sect;pn5&deg;1e&yen;&Ucirc;3&weierp;r1W&Dagger;2 J&lsaquo;S7A1j0sc&1pkt1qq2iZ561vn81&lowast;e22Q3+723&Scaron; &sum;RkLaKX2as2s22 &iuml;111lD2z8o278wwU&ndash;&Agrave;C T6U2a&upsih;938s20G&yuml; Ox2&isin;$98&lsquo;R21H25.&Ograve;L6b9&theta;r&delta;292f9j
  363. Please matt on his neck. Okay matt huï ed into your mind
  364. Since her head to check dylan. Where dylan matt got up there
  365. 1&Egrave;&plusmn;&Alpha;AYQ1dN12&upsih;XT00&Agrave;vI&or;&iacute;o8-1b&reg;8A&Epsilon;1V4Lg&Otilde;&uarr;7LKtgcEiw1yR5Y22GRA1&deg;I10C2C2Ti&uuml;/2wc0Ax211S&Uuml;&Acirc;2&OElig;T&Aacute;22&ograve;HpN&acirc;&ugrave;M6&Egrave;10A5Tb1:Simmons and now you really is what. Matt picked up this moment later that.
  366. 251yV922Yeg1&uarr;DnJ3l4t22b1os&prod;jll&divide;iS2iwB&Icirc;4n021&Ouml; 1f&divide;2a11l2su&Uacute;82 2LCblgvN&frac12;o1oP3wn&spades;90 FZora&M&trade;xs&Kappa;bb1 251&xi;$12&middot;22iG2&nabla;1&supe;&Xi;&not;3.0P0&kappa;53V1203&Yacute;Yz
  367. 2X&cent;BAZ4Kwddu2vvuB&uarr;&Beta;a1&rsquo;THi0&mdash;93rZ&epsilon;j0 1r&Mu;1a2111s71&Iota;f 8&dArr;2olW&bdquo;62o6yH&yen;wKZ&and;6 21h2aKJ&ldquo;&real;s48I&Igrave; 21&not;1$Z&Sigma;122&ntilde;26B42YMZ.21V19f10&aring;54&lceil;R8
  368. 2w\"9N2gB&Agrave;a2S&ecirc;1s&cong;gG&Ocirc;o0Dn4n&crarr;&gamma;7&otimes;eS7e2xf3Jd q&divide;CMa221isNMZp zz0&tilde;l&Kappa;Lw8o229ww1&sect;Qu 1D&lceil;&iacute;a2212sJ811 3o&ugrave;2$&brvbar;1N&real;1>R2t7WPM1.181D92k5D9&lowast;8&asymp;R
  369. l131Sj1&Psi;8p&Sigma;2K&ugrave;i6rr2rb&Ucirc;u&not;i2V&lowast;&prod;v5&ordf;10a27B1 &Uacute;&diams;&Xi;sa9j3&chi;sa1i&Omicron; Oi&weierp;ml6&oacute;f2owbz&forall;wA6&ugrave;&rarr; 22b2ai1wbs&diams;&beta;Gs 281i$i&Agrave;&circ;12&sup;2wC82n8o.13NJ9S11&Theta;0P1Sd
  370. What made no one in each time.
  371. Mommy was thinking of course beth. Everything you need the same thing
  372. P2EVG29srEx&lArr;9oN3U1yE2i2OR5k&Ccedil;&yuml;A&Tau;&eta;&nu;ULP&iquest;&and;q R5&iquest;FHt7J6E&raquo;1C&empty;A2&exist;aVLu&lowast;&cent;tT&lang;21&scaron;Hq9N&eacute;:
  373. &perp;&THORN;21T11BrrC712ad&scaron;6lmzb16ai07tdBo&times;Kop&iacute;&Rho;1lj4Hy 2a&Oacute;1a&Ouml;&iacute;&notin;&Oacute;s1a2&rsquo; 4D1kleow2o3&ndash;12wjR&le;&Pi; 1Rh2af27&cong;s26u2 8NLV$&cup;&dArr;1&darr;1Y&para;21.v2&Egrave;232S7202n11
  374. m5VKZy3K2i&ntilde;21Dt&Uacute;2HrhGaMvr5&iuml;R1o11nam&Mu;w22anFu8x7&lceil;sU E4cva11&epsilon;&trade;s7&Alpha;GO dA35ld&ntilde;&Igrave;&egrave;oA&xi;I1wXK2n f1x&frac34;a&prod;7ffs&dagger;222 5msC$72t10z&bdquo;n2.it1T7O8vt5182&middot;
  375. J&iuml;12Pk&aacute;O1rn2rAo8s5&empty;z&mdash;4Rha11t&tilde;cq5Y&Chi; &Tau;Q2ra2&rfloor;4&sup1;s&Uuml;51&sect; 2VB&iota;luw2ioL32Bw1111 5&isin;22a1I22s&scaron;&Ucirc;21 G17&rho;$kJM80&sim;&ang;&alefsym;l.J1Km3212&sup;52&eacute;&frac14;&sect;
  376. p121A1NU0c&yen;x2fo&lang;22cm14QGpHEj7lnDPVieV21a&Pi;2H7 1j26azBSes&euml;1c9 &acute;2&Ugrave;&not;l0n21o22RVw1X1&Iuml; &alpha;V21a&cong;&sigma;1Zs&sect;jJ&aring; 3pFN$1Kf821Y&Omicron;7.32Y95J&Alpha;q&Yuml;0v91Q
  377. &ntilde;&uarr;yjP&Tau;1u6rFwhNeCO&piv;2d5&Gamma;&ecirc;cne&frac14;a0iTF15sxUS0o88&alefsym;1la&Aring;T&weierp;oOB11n2111e&and;Kpf &upsilon;98&xi;abp&dagger;3sj82& 9&copy;Bol2AWSo7wNgw21mM tteQat0&piv;2s4&equiv;N&Ccedil; &Otilde;&AElig;1&Theta;$2R2q0117&ordf;.mt111&mdash;uwF57H&clubs;f
  378. &aelig;&cup;HYSj&psi;3By&scaron;1g1ndX15t1126hZ&rArr;y2r82mdowy2di&psi;8Y&Eta;d0r&scaron;&Scaron; N029a13I&brvbar;sQa&yacute;2 20Y7lZ118o&int;50&Ccedil;w1\"1&Zeta; n6&Uuml;&ge;a&nabla;l&szlig;nsF&rsaquo;J9 1D&Omicron;K$142L0S7z2.Ta2X31R9953911
  379. Turning to mess up with. Well that to give her face
  380. Another for what she found it then. Since the best to hear
  381. GX1&diams;Ca2isA18&iexcl;bN2&icirc;81A22z&Theta;D&nabla;tNXIfWi&ndash;Ap2WYNYF1b &ne;7y&phi;Dpj6&copy;R04E1U1&ntilde;n7G1o2jS111&ni;TC&perp;&pi;&Euml;O1&lowast;21RtS2wE6621 &nu;222ASi21DP&ldquo;8&lambda;V&and;W&sdot;OA2g6qNtNp1T269XA7&yen;11GGI6SEwU22S3&Chi;12!Okay let matt climbed in front door. Well then dropped the best she kissed
  382. 122C>&Phi;221 flQkWM&Scaron;tvo2dV1rT1ZtlN6R9dZ12LwuD19i3B5Fdc&AElig;l2eSwJd K1tDDfoX&plusmn;evr&yacute;wlK7P&divide;i1e13v2z&egrave;Ce&not;&Mu;&clubs;&Nu;rGhs2y172Y!gZp&aacute; R6O4O112&ni;r92Z1dB6i1e2&sigma;&sim;&Oacute;rCZ1s 122I31e2&curren;+&rceil;C&ecirc;U 1k6wG1c&sbquo;1o60AJoR72sd3i11s22pt &Oslash;277a2&forall;f5np&curren;n2duE8&rArr; 21SHGJVAtew&nabla;L&euml;t&sigmaf;2D2 6k28FgQQ&sub;R81L2EI2&notin;iEH&Iacute;&Eacute;3 H2r5Af1qxim&sigmaf;&rho;&Dagger;r6&copy;2jmWv92aW21giAC21lM&rfloor;1k 2V2&cedil;S2&ugrave;&theta;2h15B&Iota;i&lowast;ttEp8&cent;EPpSzWJi32U2n5&igrave;Ihgx8n&rceil;!j&prod;e5
  383. x1qJ>mC7f 512y1GA420lCQe09s9u%uks&atilde; &psi;2X5A4g3nu&larr;&Tau;yst72pMh&scaron;g12e&rang;p&Uacute;1n1Y&fnof;&Scaron;t&Eacute;2LGizqQ&darr;c3t&Ugrave;I &oelig;&iuml;bXMK&Ucirc;RSertj2d\"Ot2ss581!oo2i F&Acirc;W2EW2DDx7hI2p&Phi;S2Bi2drUr&hArr;J<2a1&Alpha;zwt01p2i28R2oH21&Auml;n172r 1122DYvO7ak21ht204&Pi;e&part;&lambda;11 12dUo&omicron;1X3fc631 e&&cup;GOxT3CvXcO1e3K2&nu;r31y2 262z31&infin;I1 P&igrave;&exist;zYt6F4e6&egrave;&dArr;va5229rk&Theta;32sKP5R!&iota;&micro;mz
  384. 3212>22&prime;L 2&oacute;B&perp;S&cap;OQMe&yacute;&notin;2&Phi;c229Tu2a&int;dr25&ucirc;MeLk92 121OO&oslash;9oKn&yuml;&psi;&Agrave;Wl7H2&empty;i9&rho;&Egrave;2ni2&bull;2eXPx&iacute; 1251SUqtBh72a5otSZ9p222Dpf1&Yacute;2i2&omega;bjn11&Yuml;2gs2h&minus; b&aring;2swx2oSiq8hvt2262h&lceil;b&sup2;S 26&thorn;SVBEFCi2U&agrave;ds9&Ntilde;1&Epsilon;a11&xi;2,1&bdquo;wv jw7AMK2&harr;la2G91s23&laquo;etuB2keD&atilde;2&igrave;r1&uml;IeC&frac34;Ea&Auml;ao&divide;&Prime;&and;r>6e1d9D21,mtS2 I&lowast;44A1R&circ;2M98zME&cong;Q&Yuml;&ETH;X&sup1;4j6 20n3a1&apos;22nxpl6d832J 06&ETH;9E22&yacute;2-2829c42r2h72&yen;med&frac12;&spades;kc23sPk12&bull;r!&rang;QCa
  385. &Scaron;e21>1&sigma;12 bp&oslash;NERN8eaD61ns7Abhy&plusmn;12&cap; D7sVR8&apos;1Ee22DVfc&tilde;32u72&AElig;qnc23qd2&sim;4&nabla;s&rho;mi5 6212a21&prop;TnQb9sd1M&ugrave;&image; &sum;gM22bN2&para;4c&auml;&frac12;&sube;/4X1&kappa;71f1z &piv;12ECzf&bull;1uMbycs1&bull;9&frac34;ts0T2o3h2DmSs31e7B2&Eacute;r2&sdot;22 &phi;81&Prime;SSX&eth;1u&uacute;I15p58uHp2c2&plusmn;o&part;T1Rrd6sMt&cup;1&micro;&xi;!24Xb
  386. Both hands through the fear in front.
  387. Wade to give it seemed like this. Yeah but one for any longer. Everything you going inside the kids.
  388. [1] http://pxmzcgy.storeprescription.ru?zz=fkxffti
  389. "
  390. },
  391. },
  392. {
  393. :data => IO.read('test/fixtures/mail21.box'),
  394. :body_md5 => '9c08ff6ac8817e7dbea6d2ef04dc7bc3',
  395. :params => {
  396. :from => 'Viagra Super Force Online <pharmacy_affordable1@ertelecom.ru>',
  397. :from_email => 'pharmacy_affordable1@ertelecom.ru',
  398. :from_display_name => 'Viagra Super Force Online',
  399. :subject => 'World Best DRUGS Mall For a Reasonable Price.',
  400. :to => 'info@znuny.nix',
  401. },
  402. },
  403. {
  404. :data => IO.read('test/fixtures/mail22.box'),
  405. :body_md5 => '57cf207fb52f01f107ae008eb2f8d6cc',
  406. :params => {
  407. :from => 'Gilbertina Suthar <ireoniqla@lipetsk.ru>',
  408. :from_email => 'ireoniqla@lipetsk.ru',
  409. :from_display_name => 'Gilbertina Suthar',
  410. :subject => 'P..E..N-I..S__-E N L A R-G E-M..E..N T-___P..I-L-L..S...Info.',
  411. :to => 'Info <info@znuny.nix>',
  412. :body => "Puzzled by judith bronte dave. Melvin will want her way through with.
  413. Continued adam helped charlie cried. Soon joined the master bathroom. Grinned adam rubbed his arms she nodded.
  414. Freemont and they talked with beppe.
  415. Thinking of bed and whenever adam.
  416. Mike was too tired man to hear.I10PQSHEJl2Nwf&tilde;2113S173 &Icirc;1mEbb5N371L&piv;C7AlFnR1&diams;HG64B242&brvbar;M2242zk&Iota;N&rceil;7&rceil;TBN&ETH; T2xPI&ograve;gI2&Atilde;lL2&Otilde;ML&perp;22Sa&Psi;RBreathed adam gave the master bedroom door.
  417. Better get charlie took the wall.
  418. Charlotte clark smile he saw charlie.
  419. Dave and leaned her tears adam.Maybe we want any help me that.
  420. Next morning charlie gazed at their father.
  421. Well as though adam took out here. Melvin will be more money. Called him into this one last night.
  422. Men joined the pickup truck pulled away. Chuck could make sure that.[1]&dagger;p1C?L&thinsp;I?C&ensp;K?88&ensp;5 E R?EEOD !Chuckled adam leaned forward and le? charlie.
  423. Just then returned to believe it here.
  424. Freemont and pulling out several minutes.
  425. [1] &#104;&#116;&#116;&#112;&#58;&#47;&#47;&#1072;&#1086;&#1089;&#1082;&#46;&#1088;&#1092;?jmlfwnwe&ucwkiyyc
  426. ",
  427. },
  428. },
  429. {
  430. :data => IO.read('test/fixtures/mail23.box'),
  431. :body_md5 => '545a1b067fd10ac636c20b44f5df8868',
  432. :params => {
  433. :from => 'marketingmanager@nthcpghana.com',
  434. :from_email => 'marketingmanager@nthcpghana.com',
  435. :from_display_name => '',
  436. :subject => nil,
  437. :to => 'undisclosed-recipients: ;',
  438. },
  439. },
  440. {
  441. :data => IO.read('test/fixtures/mail24.box'),
  442. :body_md5 => 'd41d8cd98f00b204e9800998ecf8427e',
  443. :params => {
  444. :from => 'oracle@IG0-1-DB01.example.com',
  445. :from_email => 'oracle@IG0-1-DB01.example.com',
  446. :from_display_name => '',
  447. :subject => 'Regelsets im Test-Status gefunden: 1',
  448. :to => 'support@example.com',
  449. :body => '',
  450. },
  451. :attachments => [
  452. {
  453. :data => 'RULESET_ID;NAME;ACTIV;RUN_MODE;AUDIT_MODIFY_DATE
  454. 387;DP DHL JOIN - EN : Einladung eAC;T;SM;1.09.14
  455. ',
  456. :md5 => 'a61c76479fdc2f107fe2697ac5ad60ae',
  457. :filename => 'rulesets-report.csv',
  458. },
  459. ],
  460. },
  461. {
  462. :data => IO.read('test/fixtures/mail25.box'),
  463. :body_md5 => '436f71d8d8a4ffbd3f18fc9de7d7f767',
  464. :params => {
  465. :from => 'oracle@IG0-1-DB01.example.com',
  466. :from_email => 'oracle@IG0-1-DB01.example.com',
  467. :from_display_name => '',
  468. :subject => 'Regelsets im Test-Status gefunden: 1',
  469. :to => 'support@example.com',
  470. :body => "begin 644 rulesets-report.csv
  471. M4E5,15-%5%])1#M.04U%.T%#5$E6.U)53E]-3T1%.T%51$E47TU/1$E&65]$
  472. M051%\"C,X-SM$4\"!$2$P@2D])3B`M($5.(#H@16EN;&%D=6YG(&5!0SM4.U--
  473. *.S$W+C`Y+C$T\"@``
  474. `
  475. end
  476. ",
  477. },
  478. },
  479. ]
  480. files.each { |file|
  481. parser = Channel::EmailParser.new
  482. data = parser.parse( file[:data] )
  483. # check body
  484. md5 = Digest::MD5.hexdigest( data[:body] )
  485. assert_equal( file[:body_md5], md5 )
  486. # check params
  487. file[:params].each { |key, value|
  488. if key.to_s == 'body_md5'
  489. puts 'md5'
  490. puts '++' + data[:body].to_s + '++'
  491. puts '++' + file[:params][key.to_sym].to_s + '++'
  492. assert_equal( Digest::MD5.hexdigest( file[:params][key.to_sym].to_s ), Digest::MD5.hexdigest( data[:body].to_s ) )
  493. else
  494. assert_equal( file[:params][key.to_sym], data[key.to_sym], "check #{key}" )
  495. end
  496. }
  497. # check attachments
  498. if file[:attachments]
  499. attachment_count_config = file[:attachments].length
  500. attachment_count_email = 0
  501. file[:attachments].each { |attachment|
  502. attachment_count_email += 1
  503. found = false
  504. data[:attachments].each { |attachment_parser|
  505. next if found
  506. file_md5 = Digest::MD5.hexdigest( attachment_parser[:data] )
  507. #puts 'Attachment:' + attachment_parser.inspect + '-' + file_md5
  508. if attachment[:md5] == file_md5
  509. found = true
  510. assert_equal( attachment[:filename], attachment_parser[:filename] )
  511. end
  512. }
  513. if !found
  514. assert( false, "Attachment not found! MD5: #{attachment[:md5]} - #{attachment[:filename].to_s}" )
  515. end
  516. }
  517. assert_equal( attachment_count_config, attachment_count_email )
  518. end
  519. }
  520. end
  521. end