Skip to content

AeroNotix/libsmtp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 

Repository files navigation

libsmtp is an add-on package for Go's net/smtp package.

The original net/smtp is rightfully incomplete, Go intends the standard library to remain small, nimble and manageable. The SMTP specification is none of those things.

libsmtp provides support for attachments and filling the client-fields in e-mail messages.

package main

import (
	"fmt"
	"github.com/AeroNotix/libsmtp"
	"net/smtp"
	"io"
	"os"
)

func main() {
	auth := smtp.PlainAuth(
		"",
		"your_email",
		"password",
		"smtp.domain.com",
	)
	f, _ := os.Open("/path/to/file/")
	fmt.Println(
		libsmtp.SendMailWithAttachments(
			"smtp.domain.com:port",
			&auth,
			"from@address.com",
			"Y u no talk?",
			[]string{"recipient@address.com"},
			[]byte("Message!"),
			map[string]io.Reader{
				"filename": f,
			},
		),
	)

}

About

Simple additions to Go's net/smtp package

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages