# Mailpiece with SendGrid

*Send your newsletter through SendGrid's SMTP relay.*

Mailpiece sends every issue through SendGrid's SMTP relay with one API key.

## What you get

- Issues, test issues, welcome emails and confirmations
- Each newsletter's own from name, from address and reply-to
- The app's sign-in mail through the same SendGrid account
- Prefer its API? [Send through a relay](https://mailpiece.dev/docs/relay).

## Set up SendGrid

Authenticate your sending domain, then create an API key with at least Mail Send permission. Copy it: it is shown once.

## Set the outgoing mail

On Settings › Outgoing mail, set up an SMTP server: the Server is `smtp.sendgrid.net`, the Port `587`, the Username the literal word `apikey` and the Password your API key. Port `587` uses STARTTLS; port `465` is TLS from the first byte.

```sh
# Or from the CLI
mailpiece settings sending smtp update --address smtp.sendgrid.net --port 587 \
  --username apikey --password SG....

# The app's sign-in mail, optional: the same values
SMTP_ADDRESS=smtp.sendgrid.net
SMTP_USERNAME=apikey
SMTP_PASSWORD=SG....
```

## Send a test issue

Set a from address on your authenticated domain in Settings › Sending and send a test issue from any post. If it does not arrive, check SendGrid's activity feed.

## Set it up this afternoon

Install Mailpiece on a server, connect SendGrid, and send your next issue. [Install Mailpiece](https://mailpiece.dev/docs/install)
