Skip to content

Commit

Permalink
readme: drop unencrypted client example
Browse files Browse the repository at this point in the history
We don't want to encourage people to turn TLS off.
  • Loading branch information
emersion committed Aug 24, 2023
1 parent b4f3805 commit c43c4c3
Showing 1 changed file with 1 addition and 34 deletions.
35 changes: 1 addition & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,40 +45,7 @@ func main() {
}
```

If you need more control, you can use `Client` instead. For example, if you
want to send an email via a server without TLS or auth support, you can do
something like this:

```go
package main

import (
"log"
"strings"

"github.com/emersion/go-smtp"
)

func main() {
// Setup an unencrypted connection to a local mail server.
c, err := smtp.Dial("localhost:25")
if err != nil {
return err
}
defer c.Close()

// Set the sender and recipient, and send the email all in one step.
to := []string{"[email protected]"}
msg := strings.NewReader("To: [email protected]\r\n" +
"Subject: discount Gophers!\r\n" +
"\r\n" +
"This is the email body.\r\n")
err := c.SendMail("[email protected]", to, msg)
if err != nil {
log.Fatal(err)
}
}
```
If you need more control, you can use `Client` instead.

### Server

Expand Down

0 comments on commit c43c4c3

Please sign in to comment.