A2P 10DLC Campaign Vetting Delays: We are experiencing delays while vetting 10DLC campaigns. Our third party is reviewing campaigns manually, and due to the high volume of requests, a queue has built up. Campaign reviews are expected to take longer. Twilio is working with the provider to help expedite this process. New details will be shared in our incident report as soon they become available.

Forwarding SMS Messages to your Email Inbox

Incoming Twilio Programmable SMS Messages can be forwarded to an email inbox with just a few lines of code. Here are two examples to get you up and running quickly.

Forward Incoming SMS Messages using Twilio Functions

If you don't already have hosting for your code, Twilio Functions can be used to host your Node.js scripts. Our Dev team has put together a helpful guide showing how to use SendGrid in conjunction with Functions to forward messages to your email, complete with sample code. You can find the tutorial here: Forward incoming SMS messages to email with Node.js, SendGrid and Twilio Functions.

Forward Incoming SMS Messages using Webhooks

To host your own code as a Twilio webhook, you can use any language you like. The following example uses PHP. Here's what it takes to make this code work:

  1. Modify the code below to update the From and To email addresses.
  2. Publish this file to a Twilio-accessible URL on your web server.
  3. Update your Twilio Phone Number's webhook with your application's URL.
* This section ensures that Twilio gets a response.
header('Content-type: text/xml');
echo '<?xml version="1.0" encoding="UTF-8"?>';
echo '<Response></Response>'; //Place the desired response (if any) here
* This section actually sends the email.

/* Your email address */
$to = "your-email@example.com";
$subject = "Message from {$_REQUEST['From']} at {$_REQUEST['To']}";
$message = "You have received a message from {$_REQUEST['From']}. Body: {$_REQUEST['Body']}";
$headers = "From: webmaster@example.com"; // Who should it come from?
mail($to, $subject, $message, $headers);

Any of the parameters which are part of the Twilio Request can also be used.

Have more questions? Submit a request
Powered by Zendesk