email check func added

This commit is contained in:
geek 2017-06-02 20:10:05 +09:00
parent 07f2d90490
commit 566103a1ad

View File

@ -11,19 +11,31 @@ import (
const ( const (
FROM = "geek@loafle.com" FROM = "geek@loafle.com"
SERVERNAME = "smtp.worksmobile.com:465" SERVER_NAME = "smtp.worksmobile.com:465"
) )
type EmailService struct { type EmailService struct {
userUrl string `json:"userUrl"`
}
func NewEmailService() *EmailService{
e := &EmailService{}
return e
}
func (e *EmailService) CheckEmail(url string) bool {
return false
} }
func EmailSendForAuth(email string) (error){ func EmailSendForAuth(email string) (error){
to := mail.Address{"",email} to := mail.Address{"Park Byung Eun",email}
from := mail.Address{"", FROM} from := mail.Address{"Overflow", FROM}
subj := "This is the Test Email" subj := "This is the Test Email"
body := "This is an Example Email\n with two lines" body := "This is an Example Email\n with two lines \n http://localhost:8080/v1/overflow/services"
// Setup headers // Setup headers
headers := make(map[string]string) headers := make(map[string]string)
@ -39,7 +51,7 @@ func EmailSendForAuth(email string) (error){
} }
message += "\r\n" + body message += "\r\n" + body
host, _, _ := net.SplitHostPort(SERVERNAME) host, _, _ := net.SplitHostPort(SERVER_NAME)
auth := smtp.PlainAuth("",FROM, "@loafle@5795", host) auth := smtp.PlainAuth("",FROM, "@loafle@5795", host)
// TLS config // TLS config
@ -48,7 +60,7 @@ func EmailSendForAuth(email string) (error){
ServerName: host, ServerName: host,
} }
conn, err := tls.Dial("tcp", SERVERNAME, tlsconfig) conn, err := tls.Dial("tcp", SERVER_NAME, tlsconfig)
if err != nil { if err != nil {
log.Panic(err) log.Panic(err)
} }