Using Sendgrid: How to Setup IP Pools (with Examples)

Last Updated on

CraftyTechie is reader-supported. When you buy through links on our site, we may earn an affiliate commission.

In this article, we will learn how to use IP pools in SendGrid. We will discuss why we use IP pools and what is the benefit of using them. We will show you how to set up and create an IP pool in SendGrid and then add an IP address to the SendGrid pool.

In this article, we will cover the following topics.

  1. Create a SendGrid Account.
  2. What is an IP Pool in SendGrid?
  3. Why should you use IP Pools in SendGrid?
  4. How do I create and set up an IP Pool in SendGrid?
  5. How do I add an IP address to SendGrid Pool?
  6. How to use an IP Pool in SendGrid when sending an Email?
  7. How do I find my IP pools in SendGrid?
  8. How to change IP in IP Pool with SendGrid?
  9. How to Delete an IP Pool in SendGrid?
  10. How many IP addresses does a pool have in SendGrid?

Before Getting Started: Create a SendGrid Account

First, we need to create a SendGrid account. To sign up for a SendGrid account, follow the steps in this SendGrid article. 

Dig Deeper with Our Email in PHP Examples and Guides

What is an IP pool

In SendGrid, an IP pool is a group of IP addresses you can pass on to your customers and resellers or utilize for your websites. It allows you to group your SendGrid IP addresses together to have more control over your deliverability and your sender reputation.

When should you use IP Pools

In SendGrid, you can have separate IP pools for both transactional and marketing emails. The main purpose of using IP pools in SendGrid is to protect your sending reputation for your emails. 

We have two main types of emails: Transactional and Marketing emails.

The Transactional email often contains important, high-priority information giving it an increased engagement and deliverability rate. On the other hand, Marketing email is usually to be sent to the spam folder since it can be seen as unwanted by the users.

So, when marketing and transaction emails are sent over the same IP address, it can bring down the overall sending reputation. And our transactional emails could be sent to the spam folder, which we don’t want to happen.

So here comes the important role of the IP pools in SendGrid, as it can avoid sending transaction emails to the spam folder.

To avoid this, you should use a separate IP pool address for your marketing and transactional emails and send your emails to the customers. This will help to maintain the high inbox placement of your transaction emails and avoid sending transactional emails to the spam folder.

How do I create and set up an IP Pool in SendGrid

To create an IP pool in SendGrid, first, you need to activate an IP in your account. 

To activate an IP in your account:

  1. Log into your SendGrid account.
  2. Navigate to Settings in SendGrid and then select IP Addresses.
  3. Now find the IP address you want to activate and then click Edit.
  4. Check “Allow my account to send mail using this IP address.”
  5. Then click Save.
Clicking IP Pools

IP pool is now activated in your SendGrid account.

Note: You must check if IP is active before creating an IP pool in SendGrid.

To create an IP Pool in SendGrid:

  1. Navigate to Settings in SendGrid and then click IP Addresses.
  2. Select IP Pools.
  3. Click Create an IP Pool.
  4. Enter a Name for your IP pool and select an IP address you want to add to your IP pool.
  5. Click Create
Creating IP Pool
Enter IP Pool Name
IP Pool Created

Your IP pool is created and ready to use.

How do I add an IP address to SendGrid Pool

You can add an IP address to a SendGrid IP pool while creating an IP pool. When we create an IP pool in SendGrid, we get options to enter the IP pool name and add an IP address, as shown in the image below.
As you can see add IP address section in the image below, this is where you can add the IP address to your IP pool in SendGrid.

Add IP Address

How to use IP Pool in SendGrid when Sending Email

Here are two quick steps to use IP to send an Email.

  1. Activate an IP.
  2. Create an IP Pool in SendGrid.

After activating and creating, your IP pool is now ready to use to send emails in SendGrid.

This PHP code sends an email using IP pool in SendGrid.

PHP Code:

<?php

function sendgrid_mailer_pools($to,$to_name,$from_email,$from_name,$cc,$subject,$message)
{
$sg = new \SendGrid('SENDGRID_API_KEY');

$request_body=json_decode('{"content":[{"type":"text/html","value": "'.$message.'"}],
"from":{"email": "'.$from_email.'",
"name": "'.$from_name.'"},
"ip_pool_name":"resume_emails_tms",
"personalizations":[{'.$cc_text.'"to":[{"email":"'.$to.'","name":"'.$to_name.'"}]}],
"reply_to":{"email": "'.$from_email.'
","name":"'.$from_name.'"},
"subject":"'.$subject.'"}', JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE);

try {$response = $sg->client->mail()->send()->post($request_body);$return=1;

} catch (Exception $e) 
{
$return=0;
}
return $return;
}
?>

How do I find my IP pools in SendGrid

You can find your IP pools easily in SendGrid. Go to your SendGrid dashboard and click on the IP address shown in the image below.

Click on IP Addresses

After clicking on the IP addresses, you will be redirected to a page like this.

Dedicated IP Addresses

Click on the IP pools, and you will find all the IP pools you created.

IP Pools

How to Change IP in IP Pool with SendGrid

To edit an IP Pool in SendGrid:

  1. Navigate to Settings in SendGrid and then click IP Addresses.
  2. Select the IP Pools.
  3. Find the IP Pool you wish to edit and select the action menu.
  4. Click on Edit.
  5. Now from here, you can edit the name of your IP pool.
  6. When you have done making all changes to your IP pool, click Save.
Edit an IP Pool

How to Delete an IP Pool in SendGrid

To delete an IP Pool in SendGrid:

  1. Navigate to Settings in SendGrid and then click IP Addresses.
  2. Select IP Pools.
  3. Find the IP Pool you wish to delete and select the action menu.
  4. Click Delete.
  5. A modal appears asking if you are sure you want to delete the assigned IP Pool. Confirm, and then click Delete.
Delete an IP Pool
Warning Message

How many IP addresses does a pool have in SendGrid

A user can create upto 100 IP pools in SendGrid. One IP pool can have more than one IP address. There is no limit.

This PHP article explains how to use an IP Pool to send an email in SendGrid. It also explains why you should use the IP pools to send emails in SendGrid. This article helps you set up a SendGrid account, activate an IP, create an IP pool, add an IP address, and edit or delete an IP pool in SendGrid. After creating an IP pool, the article demonstrates how to send an email using an IP pool in SendGrid.

The article also explores how to find the IP pools in SendGrid. You can create separate IP pools for both transactional and marketing emails, which avoids sending transactional emails to the spam folder. 

I hope you’ve enjoyed the article. Stay tuned for more at FuelingPHP

Get deeper with PHP

We have many fun articles related to PHP. You can explore these to learn more about PHP.

Did you find this article helpful?

Join the best weekly newsletter where I deliver content on building better web applications. I curate the best tips, strategies, news & resources to help you develop highly-scalable and results-driven applications.

Build Better Web Apps

I hope you're enjoying this article.

Get the best content on building better web apps delivered to you.