This commit is contained in:
geek 2017-06-08 11:20:16 +09:00
parent d75306d489
commit 3701881461

View File

@ -1,18 +1,18 @@
package email package email
import ( import (
"fmt"
"net"
"net/smtp"
"crypto/tls" "crypto/tls"
"log"
"net/mail"
"strings"
"github.com/google/uuid"
"encoding/json" "encoding/json"
"fmt"
"git.loafle.net/overflow/commons_go/model/timestamp"
"git.loafle.net/overflow/overflow_proxy_service/proxy" "git.loafle.net/overflow/overflow_proxy_service/proxy"
"git.loafle.net/overflow/overflow_proxy_service/proxy/member" "git.loafle.net/overflow/overflow_proxy_service/proxy/member"
"git.loafle.net/overflow/commons_go/model/timestamp" "github.com/google/uuid"
"log"
"net"
"net/mail"
"net/smtp"
"strings"
) )
const ( const (
@ -36,7 +36,6 @@ type Email struct {
ConfirmDate timestamp.Timestamp `json:"confirmDate,omitempty"` ConfirmDate timestamp.Timestamp `json:"confirmDate,omitempty"`
SmtpServer string `json:"_"` SmtpServer string `json:"_"`
BodyMsg string `json:"_"` BodyMsg string `json:"_"`
} }
func NewEmail(member member.Member, subject string) *Email { func NewEmail(member member.Member, subject string) *Email {
@ -54,22 +53,19 @@ func NewEmail(member member.Member, subject string) *Email {
} }
type EmailService struct { type EmailService struct {
} }
func NewEmailService() *EmailService { func NewEmailService() *EmailService {
return &EmailService{} return &EmailService{}
} }
func (es *EmailService) checkError(err error) { func (es *EmailService) checkError(err error) {
if err != nil { if err != nil {
log.Panic(err) log.Panic(err)
} }
} }
func (es *EmailService) getSendMailMessage(e *Email) (string) { func (es *EmailService) getSendMailMessage(e *Email) string {
to := mail.Address{"Park Byung Eun", e.Member.Email} to := mail.Address{"Park Byung Eun", e.Member.Email}
from := mail.Address{"Overflow", e.From} from := mail.Address{"Overflow", e.From}
//body := "This is an Example Email\n with two lines \n http://localhost:8080/v1/overflow/services" //body := "This is an Example Email\n with two lines \n http://localhost:8080/v1/overflow/services"
@ -99,8 +95,7 @@ func (es *EmailService) generationAuthToken(e *Email) string {
return tempToken return tempToken
} }
func (es *EmailService) SendEmailForAuth(e *Email) error {
func (es *EmailService)SendEmailForAuth(e *Email) (error){
to := mail.Address{"Park Byung Eun", e.Member.Email} to := mail.Address{"Park Byung Eun", e.Member.Email}
from := mail.Address{"Overflow", e.From} from := mail.Address{"Overflow", e.From}