mirror of
https://github.com/wneessen/go-mail.git
synced 2024-11-14 01:42:54 +01:00
Winni Neessen
8559e8c301
The following changes make use of methods that are not available in Go 1.17/Go 1.18. To guarantee at least 4 versions of backwards compatibility, versioned copies of those changes have been back-ported: -4d8db00641 (diff-4f6f6bdb9891d4dd271f9f31430420a2e44018fe4ee539576faf458bebb3cee4)
-58158e990f (diff-772fc9f5d0c86f26e35158fb3e7a71a4967d18b4ec23a5dbb60781ab0babf426)
42 lines
1.1 KiB
Go
42 lines
1.1 KiB
Go
// SPDX-FileCopyrightText: Copyright 2010 The Go Authors. All rights reserved.
|
|
// SPDX-FileCopyrightText: Copyright (c) 2022-2023 The go-mail Authors
|
|
//
|
|
// Original net/smtp code from the Go stdlib by the Go Authors.
|
|
// Use of this source code is governed by a BSD-style
|
|
// LICENSE file that can be found in this directory.
|
|
//
|
|
// go-mail specific modifications by the go-mail Authors.
|
|
// Licensed under the MIT License.
|
|
// See [PROJECT ROOT]/LICENSES directory for more information.
|
|
//
|
|
// SPDX-License-Identifier: BSD-3-Clause AND MIT
|
|
|
|
//go:build go1.18
|
|
// +build go1.18
|
|
|
|
package smtp
|
|
|
|
import "strings"
|
|
|
|
// ehlo sends the EHLO (extended hello) greeting to the server. It
|
|
// should be the preferred greeting for servers that support it.
|
|
func (c *Client) ehlo() error {
|
|
_, msg, err := c.cmd(250, "EHLO %s", c.localName)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
ext := make(map[string]string)
|
|
extList := strings.Split(msg, "\n")
|
|
if len(extList) > 1 {
|
|
extList = extList[1:]
|
|
for _, line := range extList {
|
|
k, v, _ := strings.Cut(line, " ")
|
|
ext[k] = v
|
|
}
|
|
}
|
|
if mechs, ok := ext["AUTH"]; ok {
|
|
c.auth = strings.Split(mechs, " ")
|
|
}
|
|
c.ext = ext
|
|
return err
|
|
}
|