kaoriMail

package module
v0.0.0-...-1aee6c4 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MIME = "MIME-version: 1.0;\nContent-Type: text/html; charset=\"UTF-8\";\n\n"
)

Variables

This section is empty.

Functions

func GetClient

func GetClient(config *oauth2.Config) *http.Client

func GetTokenFromWeb

func GetTokenFromWeb(config *oauth2.Config) *oauth2.Token

Request a token from the web, then returns the retrieved token.

func ReadMailConfig

func ReadMailConfig(scope ...string) (*oauth2.Config, error)

func SaveToken

func SaveToken(path string, token *oauth2.Token)

Saves a token to a file path.

func SendEmail

func SendEmail(serverAddress, mailAddress, mailKey, to, sub, tmpl string, data interface{}) error

func TokenFromFile

func TokenFromFile(file string) (*oauth2.Token, error)

Retrieves a token from a local file.

Types

type Attach

type Attach struct {
	FileName string
	Size     int64
	Mime     string
	Data     []byte
}

type Mail

type Mail struct {
	Msg    string
	Labels string
	Head   []*gmail.MessagePartHeader
	Attach []*Attach
}

func (*Mail) CheckAllegati

func (m *Mail) CheckAllegati() error

func (*Mail) IsUser

func (m *Mail) IsUser(db *kaoriDatabase.NoSqlDb) bool

func (*Mail) ParseMailMusic

func (m *Mail) ParseMailMusic() (*kaoriData.MusicData, error)

type Service

type Service struct {
	*gmail.Service
	Mails map[string]Mail
}

Client for read and modify mail but not delete

func NewService

func NewService(client *http.Client) (Service, error)

func (*Service) AddDataMails

func (s *Service) AddDataMails() error

func (*Service) GetMails

func (s *Service) GetMails() error

func (*Service) SendEmailOAUTH2

func (s *Service) SendEmailOAUTH2(to string, sub string, data interface{}, tmpl string) (bool, error)

func (*Service) SetMailAtRead

func (s *Service) SetMailAtRead(idm string) error

func (*Service) UnreadMails

func (s *Service) UnreadMails()

Jump to

Keyboard shortcuts

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