# SMTP 指令測試
###### tags: `smtp`
記錄一下測試SMTP的指令。
一般 smtp 用 telnet
```bash=
$ telnet smtp.gmail.com:25
Trying 142.251.8.109...
Connected to smtp.gmail.com.
Escape character is '^]'.
220 smtp.gmail.com ESMTP e14sm5278155pfv.18 - gsmtp
EHLO 10.123.6.70
250-smtp.gmail.com at your service, [123.204.7.189]
250-SIZE 35882577
250-8BITMIME
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-CHUNKING
250 SMTPUTF8
```
startls 用 openssl 指令
```bash=
$ openssl s_client -starttls smtp -connect smtp.gmail.com:25
CONNECTED(00000005)
depth=2 C = US, O = Google Trust Services LLC, CN = GTS Root R1
verify return:1
depth=1 C = US, O = Google Trust Services LLC, CN = GTS CA 1C3
verify return:1
depth=0 CN = smtp.gmail.com
verify return:1
---
Certificate chain
0 s:CN = smtp.gmail.com
i:C = US, O = Google Trust Services LLC, CN = GTS CA 1C3
1 s:C = US, O = Google Trust Services LLC, CN = GTS CA 1C3
i:C = US, O = Google Trust Services LLC, CN = GTS Root R1
2 s:C = US, O = Google Trust Services LLC, CN = GTS Root R1
i:C = BE, O = GlobalSign nv-sa, OU = Root CA, CN = GlobalSign Root CA
---
read R BLOCK
250-smtp.gmail.com at your service, [123.204.7.189]
250-SIZE 35882577
250-8BITMIME
250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-CHUNKING
250 SMTPUTF8
```
tls
```bash=
openssl s_client -connect smtp.gmail.com:465
```
在公司網路測試連不上