Skip to content

xie4ever/email

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

email

email-sdk

1.all you need

need param:

  • host
  • port
  • address
  • username
  • password

2.example

package test

import (
	"testing"

	"email"
)

const (
	testHost     = "your host"     // 邮件服务host
	testPort     = "your port"     // 邮件服务端口
	testAddress  = "your address"  // 邮件服务发送者邮箱
	testUsername = "your username" // 邮件服务发送者
	testPassword = "your password" // 邮件服务密码
)

var s *email.Sender

func init() {
	s, _ = email.NewSender(
		email.WithHost(testHost),
		email.WithPort(testPort),
		email.WithAddress(testAddress),
		email.WithUsername(testUsername),
		email.WithPassword(testPassword),
	)
}

// TestSend ...
func TestSend(t *testing.T) {
	mail := s.NewEmail().
		SetSubject("test").
		SetContent("content").
		SetToAddressList("503822883@qq.com")
	if err := s.Send(mail); err != nil {
		t.Fatal(err)
	}
}

About

email-sdk

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages