Documentation
¶
Overview ¶
Example ¶
package main
import (
"github.com/lfhy/mail"
"golang.org/x/net/proxy"
)
func main() {
mailer := mail.New(
mail.SetHost("smtp.example.com"),
mail.SetPort(587),
mail.SetUser("[email protected]"),
mail.SetPassword("password"),
mail.SetFrom("user"),
mail.SetSkipTLS(true),
mail.SetDialer(proxy.Direct),
)
mailer.SendMail("title", "test mail", "[email protected]")
}
Index ¶
- type MailConfig
- type Option
- func SetContent(content string) Option
- func SetDialer(dialer proxy.Dialer) Option
- func SetFrom(from string) Option
- func SetHost(host string) Option
- func SetPassword(password string) Option
- func SetPort(port int) Option
- func SetSkipTLS(skip bool) Option
- func SetSubject(subject string) Option
- func SetTLSConfig(config *tls.Config) Option
- func SetUser(user string) Option
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MailConfig ¶
type MailConfig struct {
User string // Send mail user: [email protected]
Password string // Send mail password: password
Host string // Send mail host: stmp.test.com
Port int // Send mail port: 465
From string // Send mail show from: testuser
Subject string // Send mail subject: test mail
Content string // Send mail content: test mail content
Dialer proxy.Dialer // Send mail dialer
TLSConfig *tls.Config
// contains filtered or unexported fields
}
func New ¶
func New(opts ...Option) *MailConfig
func (*MailConfig) Send ¶
func (m *MailConfig) Send(mailTo ...string) error
type Option ¶ added in v1.0.1
type Option func(*MailConfig)
func SetContent ¶ added in v1.0.1
func SetPassword ¶ added in v1.0.1
func SetSkipTLS ¶ added in v1.0.1
func SetSubject ¶ added in v1.0.1
func SetTLSConfig ¶ added in v1.0.1
Click to show internal directories.
Click to hide internal directories.