Returns the domain part of an email address. The domain part is the part of the email address that comes immediately after the at sign (@).
Availability
<table> <tr> <td>Marketing Cloud Engagement</td> <td>✅ Yes</td> </tr> <tr> <td>Marketing Cloud Next</td> <td>✅ Yes</td> </tr> </table>Syntax
Domain(emailAddress)
The Domain() function has one parameter:
emailAddress(string): Required. An email address.
Usage
This example returns the text after the @ sign (in this case, "example.com").
%%= Domain(sales@example.com) =%%
You can use this function with the emailaddr system personalization string. When you do, the function returns the email recipient's domain. For example, if you send a message to mary.smith@example.com, and the message body contains the AMPscript %%=Domain(emailaddr)=%%, Marketing Cloud Engagement replaces the AMPscript code with "example.com".
In some situations, the function returns null:
- If the parameter that you provide doesn't include an at sign.
- If the parameter is a non-string value.
This table shows some of the possible values that the function can return.
| Function | Result |
|---|---|
| Domain("salesforce@example.com") | example.com |
| Domain("sales@force@example") | force@example |
| Domain("salesforceexamplecom") | null |
| Domain(123) | null |