cleanups
This commit is contained in:
parent
b89934aadb
commit
696c558bc9
|
|
@ -10,23 +10,23 @@ import (
|
|||
)
|
||||
|
||||
type Mailer struct {
|
||||
server string
|
||||
port string
|
||||
auth smtp.Auth
|
||||
from string
|
||||
Server string
|
||||
Port string
|
||||
Auth smtp.Auth
|
||||
From string
|
||||
}
|
||||
|
||||
func NewMailer(server, port, username, password string) Mailer {
|
||||
auth := smtp.PlainAuth("", username, password, server)
|
||||
return Mailer{
|
||||
server: server,
|
||||
port: port,
|
||||
auth: auth,
|
||||
from: username,
|
||||
Server: server,
|
||||
Port: port,
|
||||
Auth: auth,
|
||||
From: username,
|
||||
}
|
||||
}
|
||||
|
||||
func (m *Mailer) SendMail(to []string, msg string) (err error) {
|
||||
err = smtp.SendMail(m.server+":"+m.port, m.auth, m.from, to, []byte(msg))
|
||||
err = smtp.SendMail(m.Server+":"+m.Port, m.Auth, m.From, to, []byte(msg))
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,4 +3,4 @@
|
|||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
package mail
|
||||
package mail
|
||||
|
|
|
|||
Loading…
Reference in New Issue