# Send customer email through your own mail server (Custom SMTP)

Custom SMTP sends your school's customer emails through your own mail server (for example Google Workspace or Microsoft 365), from your own address. If your server refuses a message, PiGi sends it from its own no-reply address instead.

Source: https://help.pigi.io/guides/integrations/communication/custom-smtp

## Quick answers

**Can PiGi send my customer emails from my own mail server?**
Yes. With **Custom SMTP** connected, booking, invoice and notification emails go out
through your server, from your **From Email**.

**What happens if my mail server refuses an email?**
PiGi sends that email from its own no-reply address instead, with your school's email as
the reply address and a note telling the customer how to reach you. PiGi also shows a
Custom SMTP warning in the header: "Until then, customer email goes out from PiGi's
no-reply address instead of yours." Fix the login and press **Test connection**.

**Does Custom SMTP work on PiGi's test or staging site?**
No. Customer emails go through your server on the live PiGi site only. Test and staging
sites always send through PiGi's own service.

**Does the provider on the Email card need to say Custom SMTP?**
No. Once Custom SMTP is connected with a host, username and password, customer emails go
through it whichever provider the **Email** card under Notifications → Methods shows.

**Does "Send a test email" match how customer emails are sent?**
Yes. The dialog says "Goes through your SMTP server exactly as customer emails will.",
and the test email goes out through your server from your **From Email**.

**What do I enter for Google Workspace or Gmail?**
See [Use Google Workspace or Gmail with Custom SMTP](gmail-smtp.md) for the step-by-step
setup, including 2-Step Verification, app passwords and Google's sending limits.

**What do I enter for Microsoft 365?**
**SMTP Host** `smtp.office365.com`, **SMTP Port** `587`, **Use SSL/TLS** off (PiGi then
uses STARTTLS), and the mailbox's sign-in details. Microsoft notes SMTP AUTH is off by
default for organisations created after January 2020 and has to be enabled for that
mailbox, and that basic-authentication SMTP is scheduled for retirement.

**What fields does Custom SMTP ask for?**
Required: **SMTP Host**, **SMTP Port**, **SMTP Username**, **SMTP Password**, **From
Email**. Optional: **From Name**, **Use SSL/TLS**, **Reply-To Email (optional)**.

**Test connection says "Auth failed". What do I check?**
The username and password. For Google Workspace or Gmail use an app password, not the
normal sign-in password. For Microsoft 365, make sure SMTP AUTH is enabled for the mailbox.

## What this is

Custom SMTP is PiGi's slot for your own mail server. It sits under **Communication** on
the Integrations screen. Once connected, customer emails come from your school's address.

## Current status

- **Sending:** booking confirmations, invoices and notifications go through your server.
- **Fallback:** a message your server refuses goes out from PiGi's no-reply address
  instead. See [Set up email sending](../company-setup/email-setup.md).
- **Checks:** **Test connection** logs in without sending; **Send a test email** sends
  one real email.

## Store and test your SMTP login

1. Open **Settings → Communication → Integrations**, click **Custom SMTP**, then
   **Connect Custom SMTP**.
2. Click **Add credentials** and fill in **SMTP Host**, **SMTP Port**, **SMTP Username**,
   **SMTP Password** and **From Email**, for example person@examplecompany.com. Add
   **From Name** and **Reply-To Email (optional)** if you want them. Turn **Use SSL/TLS**
   on for port 465 and off for port 587.
3. Click **Save**.
4. Click **Test connection**. "Connected to … and authenticated." means the login works.
5. Click **Send a test email**, enter an address in **Send to**, and click **Send**.
   Check that inbox.

## Troubleshooting

| Message | What to do |
|---|---|
| "Auth failed: …" | Check the username and password; for Google, see [Use Google Workspace or Gmail with Custom SMTP](gmail-smtp.md). |
| "SMTP error: …" | Check the host and port, and that **Use SSL/TLS** matches the port. |
| "Need host, username, and password to test." | Fill in the missing fields under **Update credentials**. |
| "The server refused the recipient: …" | Your server would not send to that address. Try another, or check the server's sending rules. |

## Known limitations

- **Live site only.** Customer emails go through your server on the live PiGi site;
  PiGi's test and staging sites never use it.
- **A refused email falls back.** If your server refuses a message, the customer gets
  it from PiGi's no-reply address instead, with your school's email as the reply
  address, and a Custom SMTP warning appears in the header.
- **Your mail provider's sending limits apply to every customer email.** Google
  Workspace and Gmail have daily limits; past them, emails fall back to PiGi's no-reply
  address.

## Sources

- [Google Workspace: Send email from a printer, scanner, or app](https://knowledge.workspace.google.com/admin/gmail/send-email-from-a-printer-scanner-or-app)
- [Microsoft Learn: Set up a device or application to send email using Microsoft 365](https://learn.microsoft.com/en-us/exchange/mail-flow-best-practices/how-to-set-up-a-multifunction-device-or-application-to-send-email-using-microsoft-365-or-office-365)
