package
6.8.0
Repository: https://github.com/app-nerds/kit.git
Documentation: pkg.go.dev

# README

MailService

MailService provides the basic ability to send email.

Example

service := email.NewMailService(email.Config{
	Host: "mail.something.com",
	Password: "password",
	Port: 25,
	UserName: "user",
})

if err = service.Connect(); err != nil {
	// Handle error
}

mail := email.Mail{
	Body: "This is an example",
	From: email.Person{
		Name: "Adam",
		EmailAddress: "[email protected]",
	},
	Subject: "This is a sample",
	To: []Person{
		{
			Name: "Bob Hope",
			EmailAddress: "[email protected]",
		},
		{
			Name: "Elvis Presley",
			EmailAddress: "[email protected]",
		},
	},
}

if err = service.Send(mail); err != nil {
	// Handle error
}

Validating Email Address

isValid = email.IsValidEmailAddress("whatever")
// isValid == false

# Functions

IsValidEmailAddress returns true/false if a provided email address is valid */.
NewMailService creates a new instance of MailService */.

# Structs

A Config object tells us how to configure our email server connection */.
Mail represents an email.
MailService provides methods for working with email */.
A Person is someone who sends or receives email */.

# Interfaces

IMailService provides an interface describing a service for working with email */.