# 530 5.7.0 Must issue a STARTTLS command first (TLS required before AUTH or sending)

**Code:** `530` · **Category:** Email / SMTP · **Seen on:** SMTP, Gmail, Email

The server refuses AUTH or mail until the connection is upgraded with STARTTLS.

## Meaning

Use port 587 with STARTTLS enabled in the client (`secure: false` + `requireTLS` in Nodemailer, `starttls()` in Python, "STARTTLS/TLS" in mail clients) or implicit TLS on port 465. Port 25 submission without TLS is refused by many providers.

## Common causes

- STARTTLS not enabled in the client
- Port 587 with encryption "none"
- Using port 25 without TLS
- Library skipping STARTTLS
- Misconfigured proxy removing STARTTLS

## Quick fix

1. Enable STARTTLS on 587 or use SSL/TLS on 465
2. Set the encryption option in the app
3. Test with `openssl s_client -starttls smtp`

## Detailed fix by platform

### Python

1. 

```python
s = smtplib.SMTP("smtp.example.com", 587)
s.ehlo(); s.starttls(); s.ehlo(); s.login(user, pw)
```


## How to diagnose

1. **STARTTLS** — Enabled?
2. **Port** — 587/465?
3. **Proxy** — Strips it?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/email/530-5-7-0-must-issue-a-starttls-command-first)
