68 lines
1.7 KiB
Markdown
68 lines
1.7 KiB
Markdown
# SMTPD demo server
|
|
## Warning
|
|
|
|
This is just a proof-of-concept SMTPD server showing the protocol and parsing
|
|
mechanisms.
|
|
|
|
Do *not* use it as such in production.
|
|
|
|
## License
|
|
|
|
Copyright 2022 Frédéric G. MARAND <fgm@osinet.fr>
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
|
|
|
|
## Sample exchange:
|
|
### Client-side
|
|
```
|
|
nc -c localhost 25
|
|
220 FGM-GUI22 ESMTP gosmtpd
|
|
HELO osinet
|
|
250-FGM-GUI22
|
|
250-PIPELINING
|
|
250-SIZE 10240000
|
|
250-ENHANCEDSTATUSCODES
|
|
250-8BITMIME
|
|
250 DSN
|
|
MAIL FROM:<fgm@osinet.fr>
|
|
250 2.1.0 Ok
|
|
RCPT TO:<fgm@osinet.fr>
|
|
250 2.1.0 Ok
|
|
DATA
|
|
354 Go ahead
|
|
FROM: Moi-même <mfg@osinet.fr>
|
|
To: Et moi aussi <mfg@osinet.fr>
|
|
Subject: le sujet
|
|
header: value
|
|
|
|
some more content
|
|
.
|
|
250 2.0.0 Ok: queued
|
|
quit
|
|
221 2.0.0 Bye
|
|
```
|
|
|
|
### Server-side
|
|
|
|
```
|
|
go run ./cmd
|
|
2022/12/08 21:31:18 New connection from [::1]:61067
|
|
2022/12/08 21:31:29 [Info] envelope.go:21 Inbound email from fgm@osinet.fr for fgm@osinet.fr
|
|
2022/12/08 21:32:04 [Info] envelope.go:78 From: Moi-même (mfg@osinet.fr)
|
|
2022/12/08 21:32:04 [Info] envelope.go:79 To: Et moi aussi (mfg@osinet.fr)
|
|
2022/12/08 21:32:04 [Info] envelope.go:80 Subject: le sujet
|
|
2022/12/08 21:32:04 [Info] envelope.go:81 Message:
|
|
some more content
|
|
|
|
```
|