- What is SMTP?
- How to Send Email via SMTP
- Customizing Your Send
- Scheduling Your Send
- Substitution Tags
- Section Tags
- Suppression Groups
- Unique Arguments
SMTP, or simple mail transfer protocol, is a quick and easy way to send email from one server to another. SendGrid provides a 3rd party SMTP service that allows you to deliver your email via our server instead of your own client or server.
For a deeper dive into what SMTP is, what the benefits of sending email via SMTP are, and how SendGrid can help, see the SMTP Service Crash Course on our blog.
- Create an API Key with at least “Mail” permissions.
- Set the server host in your email client or application to
- This setting is sometimes referred to as the external SMTP server or the SMTP relay.
- Set your username to
- Set your password to the API key generated in step 1.
- Set the port to
- You may send up to 100 messages per SMTP connection.
- You may open up to 10 concurrent connections from a single server.
You can customize the emails you send via SMTP by using different settings (also referred to as filters). These settings are specified within the X-SMTPAPI header.
For example, to send a blind carbon copy (BCC) of your email to the address email@example.com, include the following in your X-SMTPAPI header:
1 2 3 4 5 6 7 8 9 10
For a complete list of settings that can be enabled via the X-SMTPAPI header, see our SMTP documentation.
You can easily schedule when your email will be sent by using the
send_at parameter within your X-SMTPAPI header. Set the value of
send_at to a UNIX timestamp representing the time that you want your email to be sent.
1 2 3
For more information, see our scheduling parameters documentation.
Substitution tags allow you to dynamically insert specific content relevant to each of your recipients, such as their first and last names.
For example, to use a substitution tag to replace the first name of your recipient, insert the tag
-name- in the HTML of your message:
1 2 3 4 5 6 7 8
To define the value that will replace the
-name- tag, define the following in your X-SMTPAPI header:
1 2 3 4 5 6 7 8 9 10 11 12
For more information, see our substitution tags documentation.
Section tags are similar to substitution tags, but rather than replace tags with content for each individual recipient, section tags allow you to replace a tag with more generic content— like a salutation.
For more information, see our section tags documentation.
You can easily specify an unsubscribe group for an email sent via SMTP by including the
asm_group_id parameter in your X-SMTPAPI header. Simply set the value of
asm_group_id to the numerical ID of the group you would like to use.
1 2 3
For more information, see our suppression groups documentation.
Categories allow you to track your emails according to broad topics that you define, like “Weekly Newsletter” or “Confirmation Email”. Simply define the category by using the
category parameter within your X-SMTPAPI header:
1 2 3
For more information, see our categories documentation.
Categories should only be used for broad topics. To attach unique identifiers, please use unique arguments.
Unique arguments are a very useful way for you to track your emails based on specific identifiers unique to individual messages. Unique arguments can be retrieved via SendGrid’s Event Webhook or your email activity page.
For more information, see our unique arguments documentation.