mailer

module
v0.0.0-...-01795a6 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2021 License: MIT

README

Smtp.go

Simple library for sending utf-8 e-mails and attachments via smtp with golang

License

The MIT License (MIT). Please see License File for more information.

Installation

go get github.com/ozgur-soft/smtp.go

Usage

package main

import (
	"fmt"
	"net/mail"

	smtp "github.com/ozgur-soft/smtp.go/src"
)

func main() {
	config := smtp.Config{MailHost: "", MailPort: "", MailUser: "", MailPass: ""}
	api := &smtp.API{Config: config}
	api.SetHeaders(mail.Address{"From Name", "from@example.com"}, mail.Address{"To Name", "to@example.com"}, "Title", "Message")
	// api.AttachFile("file.pdf")
	send := api.Send()
	if send {
		fmt.Println("SENT!")
	} else {
		fmt.Println("ERROR")
	}
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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