en-US/about_SendgridTools.help.txt

TOPIC
    about_SendGridTools

SHORT DESCRIPTION
    Manage SendGrid from PowerShell through the SendGrid v3 Web API.

LONG DESCRIPTION
    SendGridTools is a PowerShell module that wraps the SendGrid v3 Web
    API. It covers these areas:

      - Mail: send messages (Send-SGMailMessage) and read email
        activity (Get-SGEmailActivity).
      - Suppressions: suppression groups, group members and global
        suppressions.
      - Bounces, blocks, spam reports and invalid emails: list and
        remove entries.
      - Authenticated domains and branded (link branding) domains:
        create, verify, change and remove.
      - Subusers: create, enable, disable and remove.
      - API keys: list, create, change and remove.
      - Alerts: create, change and remove.
      - Settings: mail, bounce purge, forward bounce, forward spam and
        address allow list settings.
      - Teammates (Get-SGTeammate), IP addresses (Get-SGIPAddress),
        designs (Get-SGDesign) and permission scopes
        (Get-SGPermissionScopes): read what the account holds.
      - Invoke-SGCommand: call an endpoint the module has no command
        for.

    To list every command, run:

        Get-Command -Module SendGridTools

    SIGNING IN
    Every session starts with Connect-SendGrid. It takes a PSCredential
    object where the Password field holds the SendGrid API key; the
    user name is not used. Connect-SendGrid -Force replaces an existing
    session. Disconnect-SendGrid ends the session.

    REGION
    SendGrid has a global host and an EU host. Connect-SendGrid -Region EU
    connects to the EU host, for an account that is hosted there.
    Connect-SendGrid -BaseUri connects to another https base URI; the path
    /v3 is added when it is missing. -Region and -BaseUri cannot be used
    together. A new session without them uses the global host, as before;
    an existing session is refreshed on its own host. -Region or -BaseUri
    naming another host than the current session starts a new session and
    asks for the key when -Credential is not given. If that connection
    fails, no session is left.

    Invoke-SGCommand takes a relative path, or a full URL on the session's
    host. It refuses a URL to another host, so the API key is sent only
    to the session's host.

    SESSION LIFETIME
    A session lasts one hour. Each command that completes a request
    renews the hour. When the hour passes without use, the next command
    fails with an error that the session has expired; run
    Connect-SendGrid -Force. A plain Connect-SendGrid fails the first
    time, because it tries to refresh the expired session.

EXAMPLES
    Example 1: Sign in

    PS C:\> $Credential = Get-Credential
    PS C:\> Connect-SendGrid -Credential $Credential

    Enter any user name and the API key as the password.

    Example 2: Sign in to the EU region

    PS C:\> Connect-SendGrid -Credential $Credential -Region EU

    Example 3: List authenticated domains with their DNS records

    PS C:\> Get-SGAuthenticatedDomain -ShowDNS

    Example 4: Send a message

    PS C:\> $Message = @{
        From = '<address>'
        To = '<address>'
        Subject = '<subject>'
        Body = '<text>'
    }
    PS C:\> Send-SGMailMessage @Message

NOTE:
    Thank you to all those who contributed to this module, by writing
    code, sharing opinions, and provided feedback.

TROUBLESHOOTING NOTE:
    If a command fails with an error that the session has expired, run
    Connect-SendGrid -Force.

    Look out on the GitHub repository for issues and new releases.

SEE ALSO
    https://github.com/PhilipHaglund/SendGridTools
    https://www.powershellgallery.com/packages/SendGridTools
    Get-Command -Module SendGridTools
    Get-Help Connect-SendGrid

KEYWORDS
    SendGrid, Email, Mail, API, Suppression, Bounce, Subuser, Domain,
    Authentication, Region, EU