mail

package
v0.0.29 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SendMailRequest

type SendMailRequest struct {
	To      []string
	Subject []byte
	Text    []byte
	Html    []byte
	Tls     bool
}

SendMailRequest is a struct that holds the necessary information for a mail sending request. It includes the recipient email addresses (To), the subject of the email (Subject), the plain text content of the email (Text), the HTML content of the email (Html), and a boolean indicating whether to use TLS for the connection (Tls).

type Smtp

type Smtp struct {
	From     string
	Addr     string
	Identity string
	Username string
	Password string
	Host     string
}

Smtp is a struct that holds the necessary information for sending an email via SMTP. It includes the sender's email address (From), the SMTP server address (Addr), the identity string for authentication (Identity), the username and password for authentication, and the host name for the SMTP server (Host).

func NewSmtp

func NewSmtp(from, addr, identity, username, password, host string) *Smtp

NewSmtp is a function that creates a new instance of the Smtp struct. It takes the sender's email address, the SMTP server address, the identity string for authentication, the username and password for authentication, and the host name for the SMTP server as arguments. The function returns a pointer to the newly created Smtp instance.

func (*Smtp) SendMail

func (s *Smtp) SendMail(req *SendMailRequest) error

SendMail is a method on the Smtp struct. It takes a pointer to a SendMailRequest struct as an argument. The method creates a new email with the information from the SendMailRequest, and sends the email via the SMTP server specified in the Smtp struct. If the Tls field in the SendMailRequest is true, the method uses a TLS connection. The method returns an error if the email sending fails.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL