Advertisement
Guest User

Untitled

a guest
Dec 10th, 2021
513
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. <?php
  2. require_once('../lib/functions.php');
  3. if (!isset($_POST['hostname'])) die();
  4. $hostname = $_POST['hostname'];
  5. $results = $_POST['results'];
  6. $ip = $_POST['ip'];
  7. $email = $_POST['email'];
  8.  
  9. awsMail('[email protected]', $email, 'log4j2 report', "found one!\n hostname: $hostname \n ip: $ip \n\n $results");
  10.  
  11. function awsMail($from, $to, $subject, $txtBody, $htmlBody = false) {
  12. global $awsClient;
  13. $SesClient = $awsClient->createSes();
  14.  
  15. if (!is_array($to)){
  16. $to = [$to];
  17. }
  18.  
  19. $toSend = [
  20. 'Source' => $from,
  21. 'Destination' => ['ToAddresses' => $to],
  22. 'Message' => [
  23. 'Subject' => ['Data' => $subject],
  24. 'Body' => [
  25. 'Text' => ['Data' => $txtBody]
  26. ]
  27. ]
  28. ];
  29.  
  30. if ($htmlBody) $toSend['Message']['Body']['Html'] = ['Data' => $htmlBody];
  31.  
  32. $SesClient->sendEmail($toSend);
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement