gosmtp

package module
v0.0.0-...-c492784 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2021 License: MIT Imports: 5 Imported by: 2

README

Go Report Card

gosmtp

Description

Very simple SMTP library.

Installation

go get github.com/mskrha/gosmtp

Usage

package main

import (
	"fmt"

	"github.com/mskrha/gosmtp"
)

func main() {
	msg := gosmtp.Message{
		From:    "test1@local",
		To:      "test2@local",
		Subject: "Test",
		Body:    "Test",
	}

	smtp, err := gosmtp.NewServer("relay.local.domain", "My simple mail 0.1")
	if err != nil {
		fmt.Println(err)
		return
	}

	if err := smtp.Send(msg); err != nil {
		fmt.Println(err)
	}
}

Documentation

Index

Constants

View Source
const (
	RFC2822 = "Mon, _2 Jan 2006 15:04:05 -0700"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	From    string `json:"from"`
	To      string `json:"to"`
	Subject string `json:"subject"`
	Body    string `json:"body"`
}

func NewMessage

func NewMessage(f, t, s, b string) (Message, error)

type SMTP

type SMTP struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(h, a string) (*SMTP, error)

func (*SMTP) Send

func (s *SMTP) Send(m Message) (id string, err error)

Jump to

Keyboard shortcuts

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