Nikeev / sesdashboard

Analytics and activity tracking dashboard for AWS Simple Email Service
https://sesdashboard.com/
MIT License
86 stars 27 forks source link

Not available to new AWS SES requests #45

Closed kripton1 closed 1 year ago

kripton1 commented 2 years ago

Amazon send request to sesdashboard's webhook and i've got a 500 error. By debuging your code i've realised that at src/Controller/WebHookController.php (51 line) no 'mail' variable. An example what Amazon sends to webhook:

{
    "Type": "Notification",
    "MessageId": "17aabafd-456d-59ed-b54f-e1ce3562f46e",
    "TopicArn": "arn:aws:sns:us-east-1:766344288637:stl-sns-topic",
    "Subject": "Amazon SES Email Event Notification",
    "Message": "{\"eventType\":\"Open\",\"mail\":{\"timestamp\":\"2022-06-27T06:11:09.451Z\",\"source\":\"TEST <info@test.com>\",\"sendingAccountId\":\"76444288517\",\"messageId\":\"01003331a3c9060b-e40603a2-dd89-477d-a3c2-fe9a03fb5eff-000000\",\"destination\":[\"rtest@gmail.com\"],\"headersTruncated\":false,\"headers\":[{\"name\":\"From\",\"value\":\"TEST <info@test.com>\"},{\"name\":\"To\",\"value\":\"rtest@gmail.com\"},{\"name\":\"Subject\",\"value\":\"=?UTF-8?Q?=F0=FF=8F=9A=E2=AC=87=EF=B8=8F_New_Inbound_Sell?=\\r\\n =?UTF-8?Q?er_in_Roane_county,_TN?=\"},{\"name\":\"MIME-Version\",\"value\":\"1.0\"},{\"name\":\"Content-Type\",\"value\":\"text/html; charset=UTF-8\"},{\"name\":\"Content-Transfer-Encoding\",\"value\":\"quoted-printable\"},{\"name\":\"Message-ID\",\"value\":\"null\"}],\"commonHeaders\":{\"from\":[\"TEST <info@test.com>\"],\"to\":[\"rtest@gmail.com\"],\"messageId\":\"01003331a3c9060b-e40603a2-dd89-477d-a3c2-fe9a03fb5eff-000000\",\"subject\":\"\uD83C\uDFDA⬇️ Test message\"},\"tags\":{\"ses:operation\":[\"SendEmail\"],\"ses:configuration-set\":[\"stl-configuration-set\"],\"ses:source-ip\":[\"54.112.133.190\"],\"ses:from-domain\":[\"test.com\"],\"ses:caller-identity\":[\"ses-smtp-user.20210529-110956\"],\"tracking\":[\"62b949fb9c8330baff353b6c\"]}},\"open\":{\"timestamp\":\"2022-06-27T09:07:11.364Z\",\"userAgent\":\"Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)\",\"ipAddress\":\"74.145.210.90\"}}\n",
    "Timestamp": "2022-06-27T09:07:11.444Z",
    "SignatureVersion": "1",
    "Signature": "JRVsgLRwGuidOpxX1iTVHVIKpRg7RRpaNFdbBHUfC229ZWUg+HtvUvx5d5PERzqLwa8LqrGmB8+rsGE/foCpRSsu6BsmMspsPw3sRY1YZdM3I7Dsc/NphOJpKR2a132Amb58kjp/NWP+jZ6FwHoOMOFd4aOBOpg5kU/LUKJDsfp8QCOzKyJEufx5dcXyt5UfeSYx+/RRQwlTU+tBCTHGBTVh8LRTClUQnaiy/Wco/ltkROfWGw/vhuV5ONKyroQGd1hIK4xed2WuSNj6hTwwXLalFIlT+IBchLGV1I4kx5nZfHDIY2He2aoHa8a4mWi9LhjreTflblhvneDOQvQ0cg==",
    "SigningCertURL": "https://sns.us-east-1.amazonaws.com/SimpleNotificationService-7ff5318444ec183fbaddaa2a969abfda.pem",
    "UnsubscribeURL": "https://sns.us-east-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-east-1:766342288637:stl-sns-topic:31cb6456-47ed-43f5-b639-13tf9f40e2d2"
}

I've fixed it with next lines of code:

else{
        $jsonData = json_decode($jsonData['Message'], true);
}

added it at line 45 in WebHookController.php file. Hope i'll help you to fix this little but noisy issue ;)

Nikeev commented 2 years ago

Hello!

Thanks for your message. I will check webhook and Amazon event format later.

But to be sure, do you have Enable raw message delivery checkbox enabled at SNS Subscription?

kripton1 commented 2 years ago

No, it's disabled. I've not even seen this instruction on AWS Marketplace: image