java - read SES emails from SQS -


i configured ses push emails sns , sqs queue, i'm reading from:

  @sqslistener("emails")   public void receiveemail(       @notificationsubject string subject,       @notificationmessage string json) {      system.out.println(subject);     system.out.println("======================");     system.out.println(json);   } 

this reads fine, payload messy, like:

{ "notificationtype": "received", "mail": {     "timestamp": "2017-08-14t16:39:59.757z",     "source": "xxxxxxx@gmail.com",     "messageid": "imc1lp6154ppg8d798h7a6ihmd936n8brmagee81",     "destination": ["root@luizkowalski.net"],     "headerstruncated": false,     "headers": [{         "name": "return-path",         "value": "<xxxxx@gmail.com>"     }, {         "name": "received",         "value": "from mail-it0-f42.google.com (mail-it0-f42.google.com [209.85.214.42]) inbound-smtp.us-east-1.amazonaws.com smtp id imc1lp6154ppg8d798h7a6ihmd936n8brmagee81 root@luizkowalski.net; mon, 14 aug 2017 16:39:59 +0000 (utc)"     }, { 

and in end, matter: e-mail

    "content": "return-path: <xxx@gmail.com>\r\nreceived: mail-it0-f42.google.com (mail-it0-f42.google.com [209.85.214.42])\r\n inbound-smtp.us-east-1.amazonaws.com smtp id imc1lp6154ppg8d798h7a6ihmd936n8brmagee81\r\n root@luizkowalski.net;\r\n mon, 14 aug 2017 16:39:59 +0000 (utc)\r\nx-ses-spam-verdict: pass\r\nx-ses-virus-verdict: pass\r\nreceived-spf: pass (spfcheck: domain of _spf.google.com designates 209.85.214.42 permitted sender) client-ip=209.85.214.42; envelope-from=xxxx@gmail.com; helo=mail-it0-f42.google.com;\r\nauthentication-results: amazonses.com;\r\n spf=pass (spfcheck: domain of _spf.google.com designates 209.85.214.42 permitted sender) client-ip=209.85.214.42; envelope-from=xx@gmail.com; helo=mail-it0-f42.google.com;\r\n dkim=pass header.i=@gmail.com;\r\nx-ses-receipt: aefbqufbqufbqufgzgnvcjjpd1phckzksjlnemh0k0tcws8zee5endzwv0ntkzm4n1dcr0tibml3stllmzh1a2p3s016ngv1uys3mkpyunntdlj6rkl5ujzkshvyb0xnoe5uv3nvzvdscjz3ylvxtdhvrxnxbuhodvrtnw9aatdiodlrq0lurhlpztc1awllyw1cwdzga3grwjrfynrnc1fhr0pzrklhnhpuskjhb2g1zdi4ddnhrgpecnnyendos3rbd2thwlzcv3nrt0l4umr5yy8vcnc0ewllnezcuxaws3vuuzb3vufdselnnxfhytdmzjdjaelwk2nzm0fnq2nrakrtvhaya0tssm1kym1nc2trsjdra0rdt09wbzzxyw==\r\nx-ses-dkim-signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple;\r\n\ts=224i4yxa5dv7c2xz3womw6peuasteono; d=amazonses.com; t=1502728800;\r\n\th=x-ses-receipt:mime-version:subject:date:from:to:message-id:content-type;\r\n\tbh=bihewgjv/einz6waxsmjdnm60xnrlrl8wszyc0hnxbk=;\r\n\tb=vfm5z3amyuutfqc9nhmlnvoywejh6n/kjxnct3lybov0uegxrfqawuwcveldr6zc\r\n\trjrxh6+kgm9/zsofhmi2/r/bx2rby/ktmvxsobdkiewxrw/uomwoq7x3plgc+98xztg\r\n\tqkjc3q1vx1iuh+cu6ucnhn0t4vzj3anxc+acv+dq=\r\nreceived: mail-it0-f42.google.com smtp id 76so20588696ith.0\r\n        <root@luizkowalski.net>; mon, 14 aug 2017 09:39:59 -0700 (pdt)\r\ndkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r\n        d=gmail.com; s=20161025;\r\n        h=mime-version:subject:date:from:to:message-id;\r\n        bh=bihewgjv/einz6waxsmjdnm60xnrlrl8wszyc0hnxbk=;\r\n        b=dm3lgsb9toadigu4qzi8dumruyvo6tbyrso3t0l3i2icsy1z/emxjg4gn/eae+tuqa\r\n         cbgcj31gcspulshhchu0mmgikjoigmpdlx1qcp6ctxnqfap9oqbsttx2cw5wko4fycmf\r\n         zmc1mxfzayghsdw6ow0ejg/1vj3o/uqelfozdnavit65lcvecxfimw9c2keerbj7a4nv\r\n         txcpfnnhh7/cbucdpxvptljhnai0jg0yx6ifszkuvomr+jbubo/iiwzcmu3ox6ld3q5c\r\n         puozg6yifvjijdfsmxzc95+a/4vbpqi7+amlmx68/n3iiinrmyjuvsyhc63g4nxjupvo\r\n         18pa==\r\nx-google-dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r\n        d=1e100.net; s=20161025;\r\n        h=x-gm-message-state:mime-version:subject:date:from:to:message-id;\r\n        bh=bihewgjv/einz6waxsmjdnm60xnrlrl8wszyc0hnxbk=;\r\n        b=kddshdix+a5w/mu3jgi9mcdv7vie9t/z4wxhim6ohx6+4c/v7xfnn25cr6e8ftoobx\r\n         9geseavujpvc5krmjqyc8hdn/6iihivchtxsrhgrdukjq/kbnqvaisawcrypozkh7x78\r\n         pqbp/niuo3cudvknsigygeyyepists1dmzkhxc67lz6jxcsisvz+jtdvoen1n3ufbgyg\r\n         qvzhustveh4laxi4igqz9gl9dkcrvedwz5kceljk3stzmz8zdafhvqqh3scul+selmpq\r\n         3j/s+xsmiqsqi7lmwbhdkofxgzcbs6+/s6qj73yuv8beozmksk0brocpyz8uplzkqs/j\r\n         7rmw==\r\nx-gm-message-state: ahyfb5jrwvipukvf/dv96a0z6frevqe0tt6dcxonis/e5ltayc97tgtx\r\n\tkz1tnuukpu6iah9fo/a=\r\nx-received: 10.36.140.131 smtp id j125mr5613236itd.43.1502728799007;\r\n        mon, 14 aug 2017 09:39:59 -0700 (pdt)\r\nreturn-path: <xx@gmail.com>\r\nreceived: localhost (235.205.188.35.bc.googleusercontent.com. [35.188.205.235])\r\n        smtp.gmail.com esmtpsa id e97sm2518001ioi.37.2017.08.14.09.39.57\r\n        <root@luizkowalski.net>\r\n        (version=tls1_2 cipher=ecdhe-rsa-aes128-gcm-sha256 bits=128/128);\r\n        mon, 14 aug 2017 09:39:57 -0700 (pdt)\r\nmime-version: 1.0\r\nsubject: asdsad\r\ndate: mon, 14 aug 2017 09:39:48 -0700\r\nfrom: \"luiz eduardo kowalski\" <xxxx@gmail.com>\r\nto: \"luiz eduardo\" <root@luizkowalski.net>\r\nx-mailer: polymail\r\nmessage-id: <5991d23089c50c0000278ba5@polymail.io>\r\ncontent-type: multipart/alternative;\r\n boundary=b8beb44c679cc9318e1befa1487771c465085cb3fca978191bcf9bf79fad\r\n\r\n--b8beb44c679cc9318e1befa1487771c465085cb3fca978191bcf9bf79fad\r\ncontent-transfer-encoding: quoted-printable\r\ncontent-type: text/plain; charset=utf-8\r\n\r\nasdsada\r\n--b8beb44c679cc9318e1befa1487771c465085cb3fca978191bcf9bf79fad\r\ncontent-transfer-encoding: quoted-printable\r\ncontent-type: text/html; charset=utf-8\r\n\r\n<img style=3d\"border: none; background:none; width: 0; height: 0;\" src=3d\"h=\r\nttps://share.polymail.io/v2/z/a/ntk5mwqymza4owm1/vekvvyktmvmrd8sr6yodrn4wqe=\r\nbzn7p-wfszqnio6prn7cnvipjlgpibauy0ao13uwb6i677e1yfrqkgrk8oehnqla66e841rzaq1=\r\n8qaq4xhztktifvn0wn4yiraqxffh-fpktbjvdby1t_-1wuxxw=3d=3d.png\" alt=3d\"\" width=\r\n=3d\"0px\" height=3d\"0px\" border=3d\"0\" /><div></div>\r\n<div>\r\nasdsada<br><br>\r\n</div>\r\n<div id=3d\"psignature\"><br></div>\r\n--b8beb44c679cc9318e1befa1487771c465085cb3fca978191bcf9bf79fad--\r\n" 

there must easier way parse email message...so far tried parse payload message (from com.amazonaws.services.sqs.model.message) got null

i'm using spring boot 1.5.6 default spring-cloud-starter-aws-messaging , java 8


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -