From adf59976ec0c44699742289744292b0c72c9aece Mon Sep 17 00:00:00 2001 From: iiuazz Date: Fri, 12 Sep 2014 15:39:28 +0800 Subject: [PATCH] email --- app/controllers/UserController.go | 3 ++- app/service/PwdService.go | 4 +++- app/service/UserService.go | 7 +++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/controllers/UserController.go b/app/controllers/UserController.go index 7e4408e..8abe42a 100644 --- a/app/controllers/UserController.go +++ b/app/controllers/UserController.go @@ -77,7 +77,8 @@ func (c User) SendRegisterEmail(content, toEmail string) revel.Result { // 发送邮件 var userInfo = c.GetUserInfo(); - url := "http://leanote.com/register?from=" + userInfo.Username + siteUrl, _ := revel.Config.String("site.url") + url := siteUrl + "/register?from=" + userInfo.Username body := fmt.Sprintf("点击链接注册leanote: %v. ", url, url); body = content + "
" + body re.Ok = SendEmail(toEmail, userInfo.Username + "邀请您注册leanote", "邀请注册", body) diff --git a/app/service/PwdService.go b/app/service/PwdService.go index b7857e5..3e3f052 100644 --- a/app/service/PwdService.go +++ b/app/service/PwdService.go @@ -2,6 +2,7 @@ package service import ( "gopkg.in/mgo.v2/bson" + "github.com/revel/revel" "github.com/leanote/leanote/app/db" "github.com/leanote/leanote/app/info" . "github.com/leanote/leanote/app/lea" @@ -31,7 +32,8 @@ func (this *PwdService) FindPwd(email string) (ok bool, msg string) { } // 发送邮件 - url := "http://leanote.com/findPassword/" + token + siteUrl, _ := revel.Config.String("site.url") + url := siteUrl + "/findPassword/" + token body := fmt.Sprintf("请点击链接修改密码: %v. %v小时后过期.", url, url, int(overHours)); if !SendEmail(email, "leanote-找回密码", "找回密码", body) { return false, "邮箱发送失败" diff --git a/app/service/UserService.go b/app/service/UserService.go index 526ae59..8e49c74 100644 --- a/app/service/UserService.go +++ b/app/service/UserService.go @@ -1,6 +1,7 @@ package service import ( + "github.com/revel/revel" "github.com/leanote/leanote/app/info" "github.com/leanote/leanote/app/db" . "github.com/leanote/leanote/app/lea" @@ -180,7 +181,8 @@ func (this *UserService) RegisterSendActiveEmail(userId string, email string) bo } // 发送邮件 - url := "http://leanote.com/user/activeEmail?token=" + token + siteUrl, _ := revel.Config.String("site.url") + url := siteUrl + "/user/activeEmail?token=" + token body := fmt.Sprintf("请点击链接验证邮箱: %v. %v小时后过期.", url, url, tokenService.GetOverHours(info.TokenActiveEmail)); if !SendEmail(email, "leanote-验证邮箱", "验证邮箱", body) { return false @@ -208,7 +210,8 @@ func (this *UserService) UpdateEmailSendActiveEmail(userId, email string) (ok bo } // 发送邮件 - url := "http://leanote.com/user/updateEmail?token=" + token + siteUrl, _ := revel.Config.String("site.url") + url := siteUrl + "/user/updateEmail?token=" + token body := "邮箱验证后您的登录邮箱为: " + email + "
"; body += fmt.Sprintf("请点击链接验证邮箱: %v. %v小时后过期.", url, url, tokenService.GetOverHours(info.TokenUpdateEmail)); if !SendEmail(email, "leanote-验证邮箱", "验证邮箱", body) {