Manage SendGrid using PowerShell
SendGridTools is a PowerShell module designed to help you manage SendGrid using its API. This module provides a set of functions and wrappers to interact with SendGrid, making it easier to automate email-related tasks.
- PowerShell 6.0 or higher (Can be lowered to 5.1 if highly requested)
- SendGrid API Key
You can install the SendGridTools module directly from the PowerShell Gallery:
Install-Module -Name SendGridTools -Scope CurrentUserClone the repository and import the module:
git clone https://github.com/PhilipHaglund/SendGridTools.git
build.ps1 -Tasks build
Import-Module SendGridTools/output/SendGridTools.psd1Importing the Module To use the SendGridTools module, you need to import it into your PowerShell session:
Import-Module SendGridToolsBefore using the cmdlets, you need to authenticate with SendGrid using your API key
Connect-SendGrid
Enter your ApiKey
Password for user apikey:The session lifetime when connecting is 1 hour and will be renewed with each cmdlet run.
Currently contains 61 functions.
For a full list of cmdlets, use the following command:
Get-Command -Module SendGridToolsSend-SGMailMessage -To 'recipient@example.com' -From 'sender@example.com' -Subject 'Test Email' -Body 'This is a test email.'Get-SGAuthenticatedDomainRequires the SendGrid 30 Days Additional Email Activity History Addon
Get-SGEmailActivity -Property ToEmail -Like 'recipient@example.com' -VerboseGet-SGEmailActivity -Filter "fromemail -contains @example.com"Get-SGEmailActivity -SendGridFilter "from_email%3D%22sender%40example.com%22"Remove-SGSuppression -Email 'user@example.com'We welcome contributions to the SendGridTools module. If you would like to contribute, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Make your changes and commit them with clear and concise messages.
- Push your changes to your fork.
- Create a pull request to the main repository.
- Please ensure that your code follows the existing coding style and includes appropriate tests.
This project is licensed under the MIT License. See the LICENSE file for more details.
Thank you to all those who contributed to this module by writing code, sharing opinions, and providing feedback.
If you encounter any issues, please check the GitHub repository for known issues and new releases. You can also open a new issue if you need further assistance.
SendGrid API Documentation PowerShell Documentation Keywords SendGrid, PowerShell, Email, API, Automation