Created
April 15, 2021 11:52
-
-
Save msebel/7c378c8489ce2cd4e51d26895a0cc733 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* | |
| A payload like the following is POSTed to your webhook | |
| { | |
| "id": "AD38DBD002", | |
| "domain": "yourdomain.ch", | |
| "from": "you@yourdomain.ch", | |
| "to": "some.name@example.com", | |
| "status": "sent", | |
| "subject": "Ihre_Anmeldung_zur_Aktion\u00e4rsveranstaltung", | |
| "time": "2021-04-15 12:32:51", | |
| "message": "status=sent (250 2.6.0 <YonMDtQuAqcWksZ8IAy3frMj7NF1xhgZ2WRFnHhXQ@example.com> [InternalId=21285857929951, Hostname=AM0PR02MB4034.eurprd02.prod.outlook.com] 38901 bytes in 0.840, 45.187 KB\/sec Queued mail for delivery)" | |
| } | |
| */ | |
| // Reading that payload in PHP is as simple as that | |
| $inputJSON = file_get_contents('php://input'); | |
| $data = json_decode($inputJSON, true); | |
| // Now $data would contain an assoc array of id, domain, from etc. | |
| // Be aware, that "message" contains the answer of the remote MTA. Some MTA tell you what the problem with a bounce is | |
| // it can be, that the mailbox doesn't exist, is full, marked the mail as spam etc. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment