Skip to content

Instantly share code, notes, and snippets.

@GlitchWitch
Last active June 19, 2022 21:12
Show Gist options
  • Save GlitchWitch/6863f471dcecad88d1c0cb9b592103c0 to your computer and use it in GitHub Desktop.
Save GlitchWitch/6863f471dcecad88d1c0cb9b592103c0 to your computer and use it in GitHub Desktop.
Twilio SMS Forward + Auto-response
<?php
/**
* This section ensures that Twilio gets a response.
*/
header('Content-type: text/xml');
echo '<?xml version="1.0" encoding="UTF-8"?>';
echo '<Response><Message>Your message could not be delivered. This number only accepts encrypted messages through Signal Private Messenger. Download it here https://signal.org/install</Message></Response>'; //Place the desired response (if any) here
/**
* This section actually sends the email.
*/
/* Your email address */
$to = "sms@domain.tld";
$subject = "Message from {$_REQUEST['From']} at {$_REQUEST['To']}";
$message = "You have received a message from {$_REQUEST['From']}. Body: {$_REQUEST['Body']}";
$headers = "From: sms@domain.tld"; // Who should it come from?
mail($to, $subject, $message, $headers);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment