Skip to content

voids/gsender

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gsender

a smtp sender written by golang

##install

go get github.com/voids/gsender

	import (
    	"github.com/voids/gsender"
    )

##demo

	sender := new(gsender.Sender)
	sender.Address = "[email protected]"
	sender.Name = "voids"
	sender.Password = "********"
	sender.Host = "smtp.example.com"
	sender.Port = 25
	// sender.TLS = true

	msg := new(gsender.Message)
	// msg.Html = true
	msg.SetSubject("A test email")
	msg.SetBody("this is a test email which sent by golang.")
	if err := msg.AddAttachment(`/home/voids/pic.jpg`); err != nil {
		panic(err)
	}

	receiver := new(gsender.Receiver)
	receiver.AddTo("John", "[email protected]")
	receiver.AddTo("Lily", "[email protected]")
	receiver.AddCc("Dog", "[email protected]")
	receiver.AddBcc("hacker", "[email protected]")

	if err := sender.Send(msg, receiver); err != nil {
		panic(err)
	}

About

a mail smtp sender written by golang

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages