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 (
FROM = "geek@loafle.com"
SERVERNAME = "smtp.worksmobile.com:465"
SERVER_NAME = "smtp.worksmobile.com:465"
)
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){
to := mail.Address{"",email}
from := mail.Address{"", FROM}
to := mail.Address{"Park Byung Eun",email}
from := mail.Address{"Overflow", FROM}
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
headers := make(map[string]string)
@ -39,7 +51,7 @@ func EmailSendForAuth(email string) (error){
}
message += "\r\n" + body
host, _, _ := net.SplitHostPort(SERVERNAME)
host, _, _ := net.SplitHostPort(SERVER_NAME)
auth := smtp.PlainAuth("",FROM, "@loafle@5795", host)
// TLS config
@ -48,7 +60,7 @@ func EmailSendForAuth(email string) (error){
ServerName: host,
}
conn, err := tls.Dial("tcp", SERVERNAME, tlsconfig)
conn, err := tls.Dial("tcp", SERVER_NAME, tlsconfig)
if err != nil {
log.Panic(err)
}