# SMS to Email trunk

An **SMS to Email trunk** forwards incoming SMS messages from your Direct
Inward Dialing (DID) numbers directly to a specified email address. Each
message is converted and delivered as a standard email. The trunk settings
define the recipient email address and the subject and body of each
forwarded email.

## How SMS delivery to email works

When someone sends an SMS to one of your DID numbers, DIDWW uses the SMS
trunk assigned to that number to determine where to deliver the message. For
an SMS to Email trunk, DIDWW converts the message into an email and sends it
to the trunk's **Recipient email** address.

```
        %%{init: {
  "theme": "base",
  "themeVariables": {
    "fontSize": "14px",
    "primaryColor": "#e0f2fe",
    "primaryBorderColor": "#38bdf8",
    "primaryTextColor": "#1f2d3d",
    "secondaryColor": "#ccfbf1",
    "secondaryBorderColor": "#2dd4bf",
    "secondaryTextColor": "#1f2d3d",
    "lineColor": "#0066cc",
    "textColor": "#1f2d3d",
    "nodeTextColor": "#1f2d3d",
    "edgeLabelBackground": "#ffffff"
  }
}}%%

flowchart LR

    sender["SMS sender"] --> |sends SMS| did["DID number"]
    did --> |assigned trunk| trunk["SMS to Email trunk"]
    trunk --> |converts SMS to email| mailbox["Recipient mailbox"]

    classDef endpoint fill:#e0f2fe,stroke:#0066cc,color:#1f2d3d,stroke-width:1.5px
    classDef process fill:#ccfbf1,stroke:#2dd4bf,color:#1f2d3d,stroke-width:1.5px

    class sender,mailbox endpoint
    class did,trunk process

    linkStyle default stroke:#0066cc,stroke-width:1.5px
```

For the sender address of forwarded emails and how to keep them from being
filtered as spam, see [SMS to Email delivery](../technical-data/guidelines.html#sms-in-guidelines-email)
in the Inbound SMS guidelines.

### Email subject and body

The **Email subject** and **Email body** settings are templates for each
forwarded email. Variables in the templates are replaced with the details of
the received SMS. For example, `{SMS_SRC_ADDR}` inserts the sender
address, `{SMS_DST_ADDR}` inserts the DID number that received the message,
and `{SMS_TEXT}` inserts the message text. For all available variables, see
[Email subject and body variables](sms-to-email-trunk-settings-reference.html#sms-to-email-trunk-settings-variables).

A long SMS that the sender's network splits into several parts is delivered
as one email. The email contains the complete, reassembled message text.
Each part is still billed as a separate fragment. For encoding limits,
concatenation, and fragment billing, see [SMS encoding
reference](../technical-data/sms-encoding-reference.html#sms-encoding-reference).

## When to use an SMS to Email trunk

Use an SMS to Email trunk when incoming messages should arrive in an email
inbox and you do not want to run an HTTP endpoint or an SMPP connection to
receive them.

If your application should receive messages directly, use an [HTTP IN
trunk](../http-in/http-in-trunk.html), which delivers each message as an HTTP
request, or an [SMPP ESME trunk](../smpp-esme/smpp-esme-trunk.html) or
[SMPP SMSC trunk](../smpp-smsc/smpp-smsc-trunk.html), which exchange
messages over SMPP. To compare all SMS trunk types, including trunks for
sending SMS, see [SMS trunks](../index.html).

## SMS to Email trunks and DID numbers

A DID number receives the SMS, while the SMS to Email trunk defines where and
how the message is forwarded by email. To receive messages, [assign the
trunk or an SMS trunk group containing it to one or more DID
numbers](../../../phone-numbers/my-numbers/how-to-guides/assign-sms-trunk.html#assigning-sms-trunk) that support inbound
SMS. Multiple DID numbers can use
the same trunk. The default email subject includes `{SMS_DST_ADDR}`, so each
email shows which DID number received the message.

## SMS to Email trunks and trunk groups

To enable failover, add the trunk to an existing [SMS trunk group](../trunk-groups/sms-trunk-groups.html) and assign the
group to your DID numbers.
Within the trunk group, the trunk's **Priority** determines the order in which
trunks are used. The system attempts to contact the target SMS trunk with the
highest-numbered priority first.

---

## Get started

Create a trunk, assign it to your DID numbers, and test delivery to your
mailbox.

**Create an SMS to Email trunk**

Set the recipient email address and the email subject and body, then
create the trunk.

[Create an SMS to Email trunk](how-to-guides/create-sms-to-email-trunk.html)

**Assign an SMS trunk**

Assign the SMS to Email trunk or its trunk group to one or more DID
numbers.

[Assign an SMS trunk](../../../phone-numbers/my-numbers/how-to-guides/assign-sms-trunk.html#assigning-sms-trunk)

**Test and view SMS logs**

Send an SMS to an assigned DID number and review its delivery in
Inbound SMS logs.

[Inbound SMS Logs](../../../logs-analytics/sms-logs/inbound-logs.html#inbound-logs)

## Manage trunks and email content

Update existing trunks and customize the forwarded email.

**Manage SMS to Email trunks**

Edit trunk settings or delete trunks that are no longer required.

[Manage SMS to Email trunks](how-to-guides/manage-sms-to-email-trunk.html)

**Email subject and body variables**

Look up the variables that insert the sender, DID number, time, and
message text into the forwarded email.

[Email subject and body variables](sms-to-email-trunk-settings-reference.html#sms-to-email-trunk-settings-variables)

## SMS trunk groups

Use these guides when the trunk will share message delivery with other SMS
trunks.

**Create an SMS trunk group**

Group existing SMS trunks and assign the group to DID numbers.

[Create an SMS trunk group](../trunk-groups/how-to-guides/create-sms-trunk-group.html)

**Set priorities in an SMS trunk group**

Set the order in which the trunks in a group are attempted.

[Set priorities in an SMS trunk group](../trunk-groups/how-to-guides/set-sms-trunk-group-priorities.html)

**SMS trunk groups**

Understand how trunk groups provide failover for inbound SMS.

[SMS trunk groups](../trunk-groups/sms-trunk-groups.html)

## Technical references

**SMS to Email trunk settings reference**

Find field definitions, variables, and trunk group settings for SMS to
Email trunks.

[SMS to Email trunk settings reference](sms-to-email-trunk-settings-reference.html)

**SMS to Email delivery**

Check the sender address of forwarded emails and allow it in your email
system.

[SMS to Email Delivery](../technical-data/guidelines.html#sms-in-guidelines-email)

**SMS encoding reference**

Review encoding limits, concatenation, and fragment billing.

[SMS encoding reference](../technical-data/sms-encoding-reference.html#sms-encoding-reference)

## Related resources

Investigate delivery problems and compare SMS trunk types.

**Inbound SMS troubleshooting**

Collect the SMS details that DIDWW Technical Support needs to
investigate a delivery problem.

[Troubleshooting](../technical-data/guidelines.html#sms-in-guidelines-troubleshooting)

**SMS trunks**

Compare SMS trunk types for receiving and sending messages.

[SMS trunks](../index.html)
