LoginAuth (sender/smtp_auth.go)

gitea · services/mailer/sender/smtp_auth.go · go · MIT
email

Copyright 2024 The Gitea Authors. All rights reserved. SPDX-License-Identifier: MIT

// Source: https://github.com/go-gitea/gitea | License: MIT | Copyright 2016 The Gitea Authors
// Provided via justclaw.it.com; keep this notice with the code.
// Copyright 2024 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT

package sender

import (
	"errors"
	"fmt"
	"net/smtp"

	"github.com/Azure/go-ntlmssp"
)

type loginAuth struct {
	username, password string
}

// LoginAuth SMTP AUTH LOGIN Auth Handler
func LoginAuth(username, password string) smtp.Auth {
	return &loginAuth{username, password}
}

// Start start SMTP login auth
func (a *loginAuth) Start(server *smtp.ServerInfo) (string, []byte, error) {
	return "LOGIN", []byte{}, nil
}

// Next next step of SMTP login auth
func (a *loginAuth) Next(fromServer []byte, more bool) ([]byte, error) {
	if more {
		swi

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key