使用 AWS api 网关的 Lambda 请求正文解析问题

问题描述 投票:0回答:2

我在收到来自 Mailgun 的请求时遇到问题,该请求的请求正文中包含电子邮件属性。我已经部署了 AWS lambda 函数和 API 网关。当请求通过 AWS API 网关时,它会对正文内容进行编码并将请求传递给 Lambda 函数,但我的 lambda 函数无法以这种方式解码内容以通过我们的实现进行使用。

我在不使用 AWS API 网关的情况下测试了我的实现,它可以工作,但它不能与 AWS API 网关一起工作。

当我转换通过 API 网关传入的请求正文内容时,该内容由 API 网关编码,但我无法转换表单中的请求正文来使用它。

解码后,我得到了这个 -

Base64.strict_decode64(base64string)


"Content-Type=multipart%2Falternative%3B+boundary%3D%22772a87c3bfe6815a93e5a01ac72bf6f3304ff90d08696b62b907422a03a3%22&Date=Fri%2C+13+Jan+2023+10%3A44%3A06+%2B0000&From=VueOps+Warranty+Ticket+%3Cservice-requests-qa%40mg.vueops-qa.com%3E&In-Reply-To%5B%5D=20230113104406.86d5542bf7d85f30%40mg.vueops-qa.com&Message-Id=%3C20230113104406.962d120183579f0f%40mg.vueops-qa.com%3E&Mime-Version=1.0&Sender=service-requests-qa%40mg.vueops-qa.com&Subject=Warranty+Ticket+SUM-EST-0204+for+Email+Subject+Test+edit+for+Sumit%27s+Test+has+been+issued+to+you+for+coordination&To=service-requests-qa%40mg.vueops-qa.com&body-html=%3C%21DOCTYPE+html%3E%0A%3Chtml%3E%0A%3Chead%3E%0A%3Cmeta+content%3D%22text%2Fhtml%3B+charset%3Dutf-8%22+http-equiv%3D%22Content-Type%22%3E%0A%3Cstyle%3Ebody+%7B%0Afont-family%3A+%27Calibri%27%2C+%27Arial%27%2C+sans-serif%3B%0A%7D%0Aimg+%7B%0Aoutline%3A+none%3B+text-decoration%3A+none%3B+-ms-interpolation-mode%3A+bicubic%3B%0A%7D%0A%3C%2Fstyle%3E%0A%3C%2Fhead%3E%0A%3Cbody+style%3D%22font-family%3A+%27Calibri%27%2C+%27Arial%27%2C+sans-serif%3B%22%3E%0A%3Ctable+align%3D%22center%22+cellpadding%3D%220%22+cellspacing%3D%220%22+class%3D%22logo%22+width%3D%22100%25%22%3E%3Ctr%3E%3Ctd+align%3D%22left%22%3E%3Cimg+src%3D%22https%3A%2F%2Fs3-us-west-1.amazonaws.com%2Fdpr-email-assets%2FVueOPS-logo-full-color-ps.png%22+style%3D%22outline%3A+none%3B+text-decoration%3A+none%3B+-ms-interpolation-mode%3A+bicubic%3B+width%3A+120px%3B%22%3E%3C%2Ftd%3E%3C%2Ftr%3E%3C%2Ftable%3E%0A%3Cp%3E%3C%2Fp%3E%0A%3Cp%3E%0A++++Hello%2C%0A%3C%2Fp%3E%0A%3Cp+class%3D%22ng-binding%22%3E%0A++++A+new+Warranty+Ticket+has+been+issued+for+Email+Subject+Test+edit+for+Sumit%27s+Test.%0A++++%3Cstrong%3EPlease+follow+the+steps+below+to+resolve+this+issue.%3C%2Fstrong%3E%0A%3C%2Fp%3E%0A%3Cp%3E%0A++++%3Cbr%3E%0A++++%3Cstrong%3ESTEP+1%3A%3C%2Fstrong%3E%0A++++Contact+the+client+contact+noted+below+for+scheduling+your+inspection+and+repair.+You+may+contact+the+client+by+phone+or+by+replying-all+to+this+email.%0A++++%3Cbr%3E%0A%3C%2Fp%3E%0A%3Cp+class%3D%22ng-binding%22%3E%0A++++%3Cstrong+style%3D%22font-size%3A+1.1em%3B%22%3EWarranty+Ticket+Details%3A%3C%2Fstrong%3E%0A++++%3Cbr%3E%0A++++%3Cstrong%3ETicket+%23%3A%3C%2Fstrong%3E+SUM-EST-0204%0A++++%3Cbr%3E%0A++++%3Cstrong%3EClient%3A%3C%2Fstrong%3E+Sumit%27s+Test%0A++++%3Cbr%3E%0A++++%3Cstrong%3EFacility%3A%3C%2Fstrong%3E+Email+Subject+Test+edit%0A++++%3Cbr%3E%0A++++%3Cstrong%3EProject%3A%3C%2Fstrong%3E+118+docs%0A++++%3Cbr%3E%0A++++%3Cstrong%3ETitle%3A%3C%2Fstrong%3E+Perferendis+voluptat%0A++++%3Cbr%3E%0A++++%3Cstrong%3EDescription%3A%3C%2Fstrong%3E+In+excepteur+aliquid%0A++++%3Cbr%3E%0A++++%3Cstrong%3ELocation%3A%3C%2Fstrong%3E+Sed+sint+nihil+moles%0A++++%3Cbr%3E%0A++++%3Cstrong%3EPriority%3A%3C%2Fstrong%3E+Emergency%0A++++%3Cbr%3E%0A++++%3Cstring%3EYou+can+view+the+ticket+details+here%3A%3C%2Fstring%3E%0A++++%3Cbr%3E%3Cbr%3E%0A++++%3Ca+ng-href%3D%22https%3A%2F%2Fsumit-s-test.vueops-qa.com%2Fservice_requests%2Fsum-est-0204%22+class%3D%22ng-binding%22+href%3D%22https%3A%2F%2Fsumit-s-test.vueops-qa.com%2Fservice_requests%2Fsum-est-0204%22+style%3D%22color%3A+%232e74b5%3B+text-decoration%3A+none%3B%22%3Ehttps%3A%2F%2Fsumit-s-test.vueops-qa.com%2Fservice_requests%2Fsum-est-0204%3C%2Fa%3E%0A++++%3Cbr%3E%0A%3C%2Fp%3E%0A%0A%3Cp%3E%0A++++%3Cstrong%3EFacility+Address%3A%3C%2Fstrong%3E%0A++++%3Cbr%3E%0A++++%3Cspan+ng-bind-html%3D%22serviceRequest.formattedFacilityAddress%22+class%3D%22ng-binding%22%3EMetro+Street%3Cbr%3EB+23+Street%3Cbr%3ENoida+City%2C+NCR+State+110092%3C%2Fspan%3E%0A++++%3Cbr%3E%0A%3C%2Fp%3E%0A%0A%3Cp+class%3D%22ng-binding%22%3E%0A++++%3Cstrong%3EClient+Contact+Information%3C%2Fstrong%3E%0A++++%3Cbr%3E%0A++++%3Cstrong%3EName%3A%3C%2Fstrong%3E+Sumit+Vueops+Account%0A++++%3Cbr%3E%0A++++%3Cstrong%3EEmail%3A%3C%2Fstrong%3E+sumitka%40vueops.com%0A++++%3Cbr%3E%0A++++%3Cstrong%3EPhone+Number%3A%3C%2Fstrong%3E+999-687-4668%0A%3C%2Fp%3E%0A%0A%3Cp%3E%0A++++%3Cstrong%3ESTEP+2%3A%3C%2Fstrong%3E%0A++++When+the+repair+work+is+complete+we+ask+that+you+respond+to+this+email+with+the+following+information+and+a+photo+of+the+completed+work%3A%0A++++%3Cbr%3E%0A%3C%2Fp%3E%0A%3Cp%3E%0A++++%3Cstrong%3EWork+Performed%3C%2Fstrong%3E%0A++++%3Cbr%3E%0A++++%3Cbr%3E%0A++++%3Cstrong%3ERoot+Cause%3A%3C%2Fstrong%3E%0A++++%3Cbr%3E%0A++++%3Cstrong%3ERepair+Date%3A%3C%2Fstrong%3E%0A%3C%2Fp%3E%0A%0A%3Cp%3E%0A++++%0A+%3C%2Fp%3E%0A%3Cdiv+class%3D%22footer%22+style%3D%22font-size%3A+10pt%3B+font-family%3A+%27FrnkGothITC+Bk+BT%27%2C+%27Calibri%27%2C+%27Arial%27%2C+sans-serif%3B+color%3A+%23999999%3B+letter-spacing%3A+2pt%3B%22%3E%3Cp%3EThank+You%2C+%3Cbr%3EPowered+by+%3Ca+href%3D%22www.vueops.com%22+style%3D%22color%3A+%232e74b5%3B+text-decoration%3A+none%3B%22%3EVueOps%3C%2Fa%3E%3Cbr%3EKnow+Your+Building+Inside+Out%3Csup%3ETM%3Csup%3E%3C%2Fsup%3E%3C%2Fsup%3E%3C%2Fp%3E%3C%2Fdiv%3E%0A%3C%2Fbody%3E%0A%3C%2Fhtml%3E%0A&body-plain=Hello%2C%0A%0AA+new+Warranty+Ticket+has+been+issued+for+Email+Subject+Test+edit+for+Sumit%27s+Test.%0APlease+follow+the+steps+below+to+resolve+this+issue.%0A%0ASTEP+1%3A%0AContact+the+client+contact+noted+below+for+scheduling+your+inspection+and+repair.+You+may+contact+the+client+by+phone+or+by+replying-all+to+this+email.%0A%0AWarranty+Ticket+Details%3A%0A%0ATicket+%23%3A+SUM-EST-0204%0A%0AClient%3A+Sumit%27s+Test%0A%0AFacility%3A+Email+Subject+Test+edit%0A%0AProject%3A+118+docs%0A%0ATitle%3A+Perferendis+voluptat%0A%0ADescription%3A+In+excepteur+aliquid%0A%0ALocation%3A+Sed+sint+nihil+moles%0A%0APriority%3A+Emergency%0A%0AYou+can+view+the+ticket+details+here%3A%0A%0Ahttps%3A%2F%2Fsumit-s-test.vueops-qa.com%2Fservice_requests%2Fsum-est-0204+%28+https%3A%2F%2Fsumit-s-test.vueops-qa.com%2Fservice_requests%2Fsum-est-0204+%29%0A%0AFacility+Address%3A%0A%0AMetro+Street%0AB+23+Street%0ANoida+City%2C+NCR+State+110092%0A%0AClient+Contact+Information%0A%0AName%3A+Sumit+Vueops+Account%0A%0AEmail%3A+sumitka%40vueops.com%0A%0APhone+Number%3A+999-687-4668%0A%0ASTEP+2%3A%0AWhen+the+repair+work+is+complete+we+ask+that+you+respond+to+this+email+with+the+following+information+and+a+photo+of+the+completed+work%3A%0A%0AWork+Performed%0A%0ARoot+Cause%3A%0A%0ARepair+Date%3A%0A%0AThank+You%2C%0APowered+by+VueOps+%28+www.vueops.com+%29%0AKnow+Your+Building+Inside+OutTM&from=VueOps+Warranty+Ticket+%3Cservice-requests-qa%40mg.vueops-qa.com%3E&message-headers=%5B%5B%22Mime-Version%22%2C%221.0%22%5D%2C%5B%22Content-Type%22%2C%22multipart%2Falternative%3B+boundary%3D%5C%22772a87c3bfe6815a93e5a01ac72bf6f3304ff90d08696b62b907422a03a3%5C%22%22%5D%2C%5B%22Subject%22%2C%22Warranty+Ticket+SUM-EST-0204+for+Email+Subject+Test+edit+for+Sumit%27s+Test+has+been+issued+to+you+for+coordination%22%5D%2C%5B%22From%22%2C%22VueOps+Warranty+Ticket+%3Cservice-requests-qa%40mg.vueops-qa.com%3E%22%5D%2C%5B%22To%22%2C%22service-requests-qa%40mg.vueops-qa.com%22%5D%2C%5B%22In-Reply-To%5B%5D%22%2C%2220230113104406.86d5542bf7d85f30%40mg.vueops-qa.com%22%5D%2C%5B%22Message-Id%22%2C%22%3C20230113104406.962d120183579f0f%40mg.vueops-qa.com%3E%22%5D%2C%5B%22Date%22%2C%22Fri%2C+13+Jan+2023+10%3A44%3A06+%2B0000%22%5D%2C%5B%22Sender%22%2C%22service-requests-qa%40mg.vueops-qa.com%22%5D%5D&recipient=service-requests-qa%40mg.vueops-qa.com&sender=VueOps+Warranty+Ticket+%3Cservice-requests-qa%40mg.vueops-qa.com%3E&signature=69257cd5ebdff97507389baaa401c9f7d370b25e43135c8695342b676412ac42&stripped-html=%3C%21DOCTYPE+html%3E%0A%3Chtml%3E%0A%3Chead%3E%0A%3Cmeta+content%3D%22text%2Fhtml%3B+charset%3Dutf-8%22+http-equiv%3D%22Content-Type%22%3E%0A%3Cstyle%3Ebody+%7B%0Afont-family%3A+%27Calibri%27%2C+%27Arial%27%2C+sans-serif%3B%0A%7D%0Aimg+%7B%0Aoutline%3A+none%3B+text-decoration%3A+none%3B+-ms-interpolation-mode%3A+bicubic%3B%0A%7D%0A%3C%2Fstyle%3E%0A%3C%2Fhead%3E%0A%3Cbody+style%3D%22font-family%3A+%27Calibri%27%2C+%27Arial%27%2C+sans-serif%3B%22%3E%0A%3Ctable+align%3D%22center%22+cellpadding%3D%220%22+cellspacing%3D%220%22+class%3D%22logo%22+width%3D%22100%25%22%3E%3Ctr%3E%3Ctd+align%3D%22left%22%3E%3Cimg+src%3D%22https%3A%2F%2Fs3-us-west-1.amazonaws.com%2Fdpr-email-assets%2FVueOPS-logo-full-color-ps.png%22+style%3D%22outline%3A+none%3B+text-decoration%3A+none%3B+-ms-interpolation-mode%3A+bicubic%3B+width%3A+120px%3B%22%3E%3C%2Ftd%3E%3C%2Ftr%3E%3C%2Ftable%3E%0A%3Cp%3E%3C%2Fp%3E%0A%3Cp%3E%0A++++Hello%2C%0A%3C%2Fp%3E%0A%3Cp+class%3D%22ng-binding%22%3E%0A++++A+new+Warranty+Ticket+has+been+issued+for+Email+Subject+Test+edit+for+Sumit%27s+Test.%0A++++%3Cstrong%3EPlease+follow+the+steps+below+to+resolve+this+issue.%3C%2Fstrong%3E%0A%3C%2Fp%3E%0A%3Cp%3E%0A++++%3Cbr%3E%0A++++%3Cstrong%3ESTEP+1%3A%3C%2Fstrong%3E%0A++++Contact+the+client+contact+noted+below+for+scheduling+your+inspection+and+repair.+You+may+contact+the+client+by+phone+or+by+replying-all+to+this+email.%0A++++%3Cbr%3E%0A%3C%2Fp%3E%0A%3Cp+class%3D%22ng-binding%22%3E%0A++++%3Cstrong+style%3D%22font-size%3A+1.1em%3B%22%3EWarranty+Ticket+Details%3A%3C%2Fstrong%3E%0A++++%3Cbr%3E%0A++++%3Cstrong%3ETicket+%23%3A%3C%2Fstrong%3E+SUM-EST-0204%0A++++%3Cbr%3E%0A++++%3Cstrong%3EClient%3A%3C%2Fstrong%3E+Sumit%27s+Test%0A++++%3Cbr%3E%0A++++%3Cstrong%3EFacility%3A%3C%2Fstrong%3E+Email+Subject+Test+edit%0A++++%3Cbr%3E%0A++++%3Cstrong%3EProject%3A%3C%2Fstrong%3E+118+docs%0A++++%3Cbr%3E%0A++++%3Cstrong%3ETitle%3A%3C%2Fstrong%3E+Perferendis+voluptat%0A++++%3Cbr%3E%0A++++%3Cstrong%3EDescription%3A%3C%2Fstrong%3E+In+excepteur+aliquid%0A++++%3Cbr%3E%0A++++%3Cstrong%3ELocation%3A%3C%2Fstrong%3E+Sed+sint+nihil+moles%0A++++%3Cbr%3E%0A++++%3Cstrong%3EPriority%3A%3C%2Fstrong%3E+Emergency%0A++++%3Cbr%3E%0A++++%3Cstring%3EYou+can+view+the+ticket+details+here%3A%3C%2Fstring%3E%0A++++%3Cbr%3E%3Cbr%3E%0A++++%3Ca+ng-href%3D%22https%3A%2F%2Fsumit-s-test.vueops-qa.com%2Fservice_requests%2Fsum-est-0204%22+class%3D%22ng-binding%22+href%3D%22https%3A%2F%2Fsumit-s-test.vueops-qa.com%2Fservice_requests%2Fsum-est-0204%22+style%3D%22color%3A+%232e74b5%3B+text-decoration%3A+none%3B%22%3Ehttps%3A%2F%2Fsumit-s-test.vueops-qa.com%2Fservice_requests%2Fsum-est-0204%3C%2Fa%3E%0A++++%3Cbr%3E%0A%3C%2Fp%3E%0A%0A%3Cp%3E%0A++++%3Cstrong%3EFacility+Address%3A%3C%2Fstrong%3E%0A++++%3Cbr%3E%0A++++%3Cspan+ng-bind-html%3D%22serviceRequest.formattedFacilityAddress%22+class%3D%22ng-binding%22%3EMetro+Street%3Cbr%3EB+23+Street%3Cbr%3ENoida+City%2C+NCR+State+110092%3C%2Fspan%3E%0A++++%3Cbr%3E%0A%3C%2Fp%3E%0A%0A%3Cp+class%3D%22ng-binding%22%3E%0A++++%3Cstrong%3EClient+Contact+Information%3C%2Fstrong%3E%0A++++%3Cbr%3E%0A++++%3Cstrong%3EName%3A%3C%2Fstrong%3E+Sumit+Vueops+Account%0A++++%3Cbr%3E%0A++++%3Cstrong%3EEmail%3A%3C%2Fstrong%3E+sumitka%40vueops.com%0A++++%3Cbr%3E%0A++++%3Cstrong%3EPhone+Number%3A%3C%2Fstrong%3E+999-687-4668%0A%3C%2Fp%3E%0A%0A%3Cp%3E%0A++++%3Cstrong%3ESTEP+2%3A%3C%2Fstrong%3E%0A++++When+the+repair+work+is+complete+we+ask+that+you+respond+to+this+email+with+the+following+information+and+a+photo+of+the+completed+work%3A%0A++++%3Cbr%3E%0A%3C%2Fp%3E%0A%3Cp%3E%0A++++%3Cstrong%3EWork+Performed%3C%2Fstrong%3E%0A++++%3Cbr%3E%0A++++%3Cbr%3E%0A++++%3Cstrong%3ERoot+Cause%3A%3C%2Fstrong%3E%0A++++%3Cbr%3E%0A++++%3Cstrong%3ERepair+Date%3A%3C%2Fstrong%3E%0A%3C%2Fp%3E%0A%0A%3Cp%3E%0A++++%0A+%3C%2Fp%3E%0A%3Cdiv+class%3D%22footer%22+style%3D%22font-size%3A+10pt%3B+font-family%3A+%27FrnkGothITC+Bk+BT%27%2C+%27Calibri%27%2C+%27Arial%27%2C+sans-serif%3B+color%3A+%23999999%3B+letter-spacing%3A+2pt%3B%22%3E%3Cp%3EThank+You%2C+%3Cbr%3EPowered+by+%3Ca+href%3D%22www.vueops.com%22+style%3D%22color%3A+%232e74b5%3B+text-decoration%3A+none%3B%22%3EVueOps%3C%2Fa%3E%3Cbr%3EKnow+Your+Building+Inside+Out%3Csup%3ETM%3Csup%3E%3C%2Fsup%3E%3C%2Fsup%3E%3C%2Fp%3E%3C%2Fdiv%3E%0A%3C%2Fbody%3E%0A%3C%2Fhtml%3E%0A&stripped-signature=Work+Performed%0A%0ARoot+Cause%3A%0A%0ARepair+Date%3A%0A%0AThank+You%2C%0APowered+by+VueOps+%28+www.vueops.com+%29%0AKnow+Your+Building+Inside+OutTM&stripped-text=Hello%2C%0A%0AA+new+Warranty+Ticket+has+been+issued+for+Email+Subject+Test+edit+for+Sumit%27s+Test.%0APlease+follow+the+steps+below+to+resolve+this+issue.%0A%0ASTEP+1%3A%0AContact+the+client+contact+noted+below+for+scheduling+your+inspection+and+repair.+You+may+contact+the+client+by+phone+or+by+replying-all+to+this+email.%0A%0AWarranty+Ticket+Details%3A%0A%0ATicket+%23%3A+SUM-EST-0204%0A%0AClient%3A+Sumit%27s+Test%0A%0AFacility%3A+Email+Subject+Test+edit%0A%0AProject%3A+118+docs%0A%0ATitle%3A+Perferendis+voluptat%0A%0ADescription%3A+In+excepteur+aliquid%0A%0ALocation%3A+Sed+sint+nihil+moles%0A%0APriority%3A+Emergency%0A%0AYou+can+view+the+ticket+details+here%3A%0A%0Ahttps%3A%2F%2Fsumit-s-test.vueops-qa.com%2Fservice_requests%2Fsum-est-0204+%28+https%3A%2F%2Fsumit-s-test.vueops-qa.com%2Fservice_requests%2Fsum-est-0204+%29%0A%0AFacility+Address%3A%0A%0AMetro+Street%0AB+23+Street%0ANoida+City%2C+NCR+State+110092%0A%0AClient+Contact+Information%0A%0AName%3A+Sumit+Vueops+Account%0A%0AEmail%3A+sumitka%40vueops.com%0A%0APhone+Number%3A+999-687-4668%0A%0ASTEP+2%3A%0AWhen+the+repair+work+is+complete+we+ask+that+you+respond+to+this+email+with+the+following+information+and+a+photo+of+the+completed+work%3A%0A&subject=Warranty+Ticket+SUM-EST-0204+for+Email+Subject+Test+edit+for+Sumit%27s+Test+has+been+issued+to+you+for+coordination&timestamp=1673613697&token=9e50b9d3b4b4cfac741c4e0a7d154ca9b52a69146937cc2ba4"

应该是这样的-

{"Content-Type"=>"multipart/alternative; boundary=\"0d4b5135bbc71f7078e98fd7ee7355506fb2c219e22a702a301bd7123e55\"", "Date"=>"Fri, 13 Jan 2023 18:31:51 +0000", "From"=>"VueOps Warranty Ticket <[email protected]>", "In-Reply-To"=>["[email protected]"], "Message-Id"=>"<[email protected]>", "Mime-Version"=>"1.0", "Sender"=>"[email protected]", "Subject"=>"Warranty Ticket SUM-EST-0204 for Email Subject Test edit for Sumit's Test has been issued to you for coordination", "To"=>"[email protected]", "body-html"=>"<!DOCTYPE html>\n<html>\n<head>\n<meta content=\"text/html; charset=utf-8\" http-equiv=\"Content-Type\">\n<style>body {\nfont-family: 'Calibri', 'Arial', sans-serif;\n}\nimg {\noutline: none; text-decoration: none; -ms-interpolation-mode: bicubic;\n}\n</style>\n</head>\n<body style=\"font-family: 'Calibri', 'Arial', sans-serif;\">\n<table align=\"center\" cellpadding=\"0\" cellspacing=\"0\" class=\"logo\" width=\"100%\"><tr><td align=\"left\"><img src=\"https://s3-us-west-1.amazonaws.com/dpr-email-assets/VueOPS-logo-full-color-ps.png\" style=\"outline: none; text-decoration: none; -ms-interpolation-mode: bicubic; width: 120px;\"></td></tr></table>\n<p></p>\n<p>\n    Hello,\n</p>\n<p class=\"ng-binding\">\n    A new Warranty Ticket has been issued for Email Subject Test edit for Sumit's Test.\n    <strong>Please follow the steps below to resolve this issue.</strong>\n</p>\n<p>\n    <br>\n    <strong>STEP 1:</strong>\n    Contact the client contact noted below for scheduling your inspection and repair. You may contact the client by phone or by replying-all to this email.\n    <br>\n</p>\n<p class=\"ng-binding\">\n    <strong style=\"font-size: 1.1em;\">Warranty Ticket Details:</strong>\n    <br>\n    <strong>Ticket #:</strong> SUM-EST-0204\n    <br>\n    <strong>Client:</strong> Sumit's Test\n    <br>\n    <strong>Facility:</strong> Email Subject Test edit\n    <br>\n    <strong>Project:</strong> 118 docs\n    <br>\n    <strong>Title:</strong> Perferendis voluptat\n    <br>\n    <strong>Description:</strong> In excepteur aliquid\n    <br>\n    <strong>Location:</strong> Sed sint nihil moles\n    <br>\n    <strong>Priority:</strong> Emergency\n    <br>\n    <string>You can view the ticket details here:</string>\n    <br><br>\n    <a ng-href=\"https://sumit-s-test.vueops-qa.com/service_requests/sum-est-0204\" class=\"ng-binding\" href=\"https://sumit-s-test.vueops-qa.com/service_requests/sum-est-0204\" style=\"color: #2e74b5; text-decoration: none;\">https://sumit-s-test.vueops-qa.com/service_requests/sum-est-0204</a>\n    <br>\n</p>\n\n<p>\n    <strong>Facility Address:</strong>\n    <br>\n    <span ng-bind-html=\"serviceRequest.formattedFacilityAddress\" class=\"ng-binding\">Metro Street<br>B 23 Street<br>Noida City, NCR State 110092</span>\n    <br>\n</p>\n\n<p class=\"ng-binding\">\n    <strong>Client Contact Information</strong>\n    <br>\n    <strong>Name:</strong> Sumit Vueops Account\n    <br>\n    <strong>Email:</strong> [email protected]\n    <br>\n    <strong>Phone Number:</strong> 999-687-4668\n</p>\n\n<p>\n    <strong>STEP 2:</strong>\n    When the repair work is complete we ask that you respond to this email with the following information and a photo of the completed work:\n    <br>\n</p>\n<p>\n    <strong>Work Performed</strong>\n    <br>\n    <br>\n    <strong>Root Cause:</strong>\n    <br>\n    <strong>Repair Date:</strong>\n</p>\n\n<p>\n    \n </p>\n<div class=\"footer\" style=\"font-size: 10pt; font-family: 'FrnkGothITC Bk BT', 'Calibri', 'Arial', sans-serif; color: #999999; letter-spacing: 2pt;\"><p>Thank You, <br>Powered by <a href=\"www.vueops.com\" style=\"color: #2e74b5; text-decoration: none;\">VueOps</a><br>Know Your Building Inside Out<sup>TM<sup></sup></sup></p></div>\n</body>\n</html>\n", "body-plain"=>"Hello,\n\nA new Warranty Ticket has been issued for Email Subject Test edit for Sumit's Test.\nPlease follow the steps below to resolve this issue.\n\nSTEP 1:\nContact the client contact noted below for scheduling your inspection and repair. You may contact the client by phone or by replying-all to this email.\n\nWarranty Ticket Details:\n\nTicket #: SUM-EST-0204\n\nClient: Sumit's Test\n\nFacility: Email Subject Test edit\n\nProject: 118 docs\n\nTitle: Perferendis voluptat\n\nDescription: In excepteur aliquid\n\nLocation: Sed sint nihil moles\n\nPriority: Emergency\n\nYou can view the ticket details here:\n\nhttps://sumit-s-test.vueops-qa.com/service_requests/sum-est-0204 ( https://sumit-s-test.vueops-qa.com/service_requests/sum-est-0204 )\n\nFacility Address:\n\nMetro Street\nB 23 Street\nNoida City, NCR State 110092\n\nClient Contact Information\n\nName: Sumit Vueops Account\n\nEmail: [email protected]\n\nPhone Number: 999-687-4668\n\nSTEP 2:\nWhen the repair work is complete we ask that you respond to this email with the following information and a photo of the completed work:\n\nWork Performed\n\nRoot Cause:\n\nRepair Date:\n\nThank You,\nPowered by VueOps ( www.vueops.com )\nKnow Your Building Inside OutTM", "from"=>"VueOps Warranty Ticket <[email protected]>", "message-headers"=>"[[\"Mime-Version\",\"1.0\"],[\"Content-Type\",\"multipart/alternative; boundary=\\\"0d4b5135bbc71f7078e98fd7ee7355506fb2c219e22a702a301bd7123e55\\\"\"],[\"Subject\",\"Warranty Ticket SUM-EST-0204 for Email Subject Test edit for Sumit's Test has been issued to you for coordination\"],[\"From\",\"VueOps Warranty Ticket <[email protected]>\"],[\"To\",\"[email protected]\"],[\"In-Reply-To[]\",\"[email protected]\"],[\"Message-Id\",\"<[email protected]>\"],[\"Date\",\"Fri, 13 Jan 2023 18:31:51 +0000\"],[\"Sender\",\"[email protected]\"]]", "recipient"=>"[email protected]", "sender"=>"VueOps Warranty Ticket <[email protected]>", "signature"=>"88d9f1b2a5f75668a0436c39050bbccd194485cd4a3b8369d2025311c87c87aa", "stripped-html"=>"<!DOCTYPE html>\n<html>\n<head>\n<meta content=\"text/html; charset=utf-8\" http-equiv=\"Content-Type\">\n<style>body {\nfont-family: 'Calibri', 'Arial', sans-serif;\n}\nimg {\noutline: none; text-decoration: none; -ms-interpolation-mode: bicubic;\n}\n</style>\n</head>\n<body style=\"font-family: 'Calibri', 'Arial', sans-serif;\">\n<table align=\"center\" cellpadding=\"0\" cellspacing=\"0\" class=\"logo\" width=\"100%\"><tr><td align=\"left\"><img src=\"https://s3-us-west-1.amazonaws.com/dpr-email-assets/VueOPS-logo-full-color-ps.png\" style=\"outline: none; text-decoration: none; -ms-interpolation-mode: bicubic; width: 120px;\"></td></tr></table>\n<p></p>\n<p>\n    Hello,\n</p>\n<p class=\"ng-binding\">\n    A new Warranty Ticket has been issued for Email Subject Test edit for Sumit's Test.\n    <strong>Please follow the steps below to resolve this issue.</strong>\n</p>\n<p>\n    <br>\n    <strong>STEP 1:</strong>\n    Contact the client contact noted below for scheduling your inspection and repair. You may contact the client by phone or by replying-all to this email.\n    <br>\n</p>\n<p class=\"ng-binding\">\n    <strong style=\"font-size: 1.1em;\">Warranty Ticket Details:</strong>\n    <br>\n    <strong>Ticket #:</strong> SUM-EST-0204\n    <br>\n    <strong>Client:</strong> Sumit's Test\n    <br>\n    <strong>Facility:</strong> Email Subject Test edit\n    <br>\n    <strong>Project:</strong> 118 docs\n    <br>\n    <strong>Title:</strong> Perferendis voluptat\n    <br>\n    <strong>Description:</strong> In excepteur aliquid\n    <br>\n    <strong>Location:</strong> Sed sint nihil moles\n    <br>\n    <strong>Priority:</strong> Emergency\n    <br>\n    <string>You can view the ticket details here:</string>\n    <br><br>\n    <a ng-href=\"https://sumit-s-test.vueops-qa.com/service_requests/sum-est-0204\" class=\"ng-binding\" href=\"https://sumit-s-test.vueops-qa.com/service_requests/sum-est-0204\" style=\"color: #2e74b5; text-decoration: none;\">https://sumit-s-test.vueops-qa.com/service_requests/sum-est-0204</a>\n    <br>\n</p>\n\n<p>\n    <strong>Facility Address:</strong>\n    <br>\n    <span ng-bind-html=\"serviceRequest.formattedFacilityAddress\" class=\"ng-binding\">Metro Street<br>B 23 Street<br>Noida City, NCR State 110092</span>\n    <br>\n</p>\n\n<p class=\"ng-binding\">\n    <strong>Client Contact Information</strong>\n    <br>\n    <strong>Name:</strong> Sumit Vueops Account\n    <br>\n    <strong>Email:</strong> [email protected]\n    <br>\n    <strong>Phone Number:</strong> 999-687-4668\n</p>\n\n<p>\n    <strong>STEP 2:</strong>\n    When the repair work is complete we ask that you respond to this email with the following information and a photo of the completed work:\n    <br>\n</p>\n<p>\n    <strong>Work Performed</strong>\n    <br>\n    <br>\n    <strong>Root Cause:</strong>\n    <br>\n    <strong>Repair Date:</strong>\n</p>\n\n<p>\n    \n </p>\n<div class=\"footer\" style=\"font-size: 10pt; font-family: 'FrnkGothITC Bk BT', 'Calibri', 'Arial', sans-serif; color: #999999; letter-spacing: 2pt;\"><p>Thank You, <br>Powered by <a href=\"www.vueops.com\" style=\"color: #2e74b5; text-decoration: none;\">VueOps</a><br>Know Your Building Inside Out<sup>TM<sup></sup></sup></p></div>\n</body>\n</html>\n", "stripped-signature"=>"Work Performed\n\nRoot Cause:\n\nRepair Date:\n\nThank You,\nPowered by VueOps ( www.vueops.com )\nKnow Your Building Inside OutTM", "stripped-text"=>"Hello,\n\nA new Warranty Ticket has been issued for Email Subject Test edit for Sumit's Test.\nPlease follow the steps below to resolve this issue.\n\nSTEP 1:\nContact the client contact noted below for scheduling your inspection and repair. You may contact the client by phone or by replying-all to this email.\n\nWarranty Ticket Details:\n\nTicket #: SUM-EST-0204\n\nClient: Sumit's Test\n\nFacility: Email Subject Test edit\n\nProject: 118 docs\n\nTitle: Perferendis voluptat\n\nDescription: In excepteur aliquid\n\nLocation: Sed sint nihil moles\n\nPriority: Emergency\n\nYou can view the ticket details here:\n\nhttps://sumit-s-test.vueops-qa.com/service_requests/sum-est-0204 ( https://sumit-s-test.vueops-qa.com/service_requests/sum-est-0204 )\n\nFacility Address:\n\nMetro Street\nB 23 Street\nNoida City, NCR State 110092\n\nClient Contact Information\n\nName: Sumit Vueops Account\n\nEmail: [email protected]\n\nPhone Number: 999-687-4668\n\nSTEP 2:\nWhen the repair work is complete we ask that you respond to this email with the following information and a photo of the completed work:\n", "subject"=>"Warranty Ticket SUM-EST-0204 for Email Subject Test edit for Sumit's Test has been issued to you for coordination", "timestamp"=>"1673638018", "token"=>"90ec0b4c8e14caf44f4bc7259699e8cefdff521b15985ebdfa"}

请建议我如何解决这个问题。

ruby aws-lambda aws-api-gateway mailgun
2个回答
0
投票

我能够找到解决方案。我得到

Content-Type  application/x-www-form-urlencoded
需要使用
URI.decode_www_form
进行转换。现在我得到了正确的 JSON 请求正文。


0
投票

是否在 Base64.strict_decode64(base64string) 之后或事件 ['body'] 上运行 URI.decode_www_form()? 我遇到了同样的问题,电子邮件通过 API 网关从 Mailgun 发送到 Lambda。我无法找到一种方法来解析传入的电子邮件,以便访问消息、发件人、发件人等...

© www.soinside.com 2019 - 2024. All rights reserved.