123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- package util
- import (
- "fmt"
- "log"
- "regexp"
- . "salesLeads/src/config"
- "time"
- "app.yhyue.com/moapp/jybase/mail"
- )
- func SendStructedDataByEmail(email string, auth []*mail.GmailAuth) bool {
- var uploadAddress = Sysconfig.Webdomain + Sysconfig.StructedUploadA
- var imagesAddress = Sysconfig.Webdomain + "/structuredata/mobile/image/emaillogo.png"
- var feedbackAddress = "mailto:bd@topnet.net.cn"
- if isEmail(email) {
- html := fmt.Sprintf(`<div style="width:100%%;display: flex;justify-content: center;">
- <div class="Email" id="Email" style="max-width:100%%;min-height: 540px;display: flex;flex-direction: column;align-items: center;">
- <div class="emailmain" style="border: 1px solid #ccc;max-width:100%%;height: 319px;border-top: 8px solid #2CB7CA;border-radius: 8px;background: #fff;margin: 0 auto; margin-top: 107px;padding: 0px 40px 20px;">
- <div class="emailmain_top" style="height: 88px;max-width:100%%;border-bottom: 1px solid #F7F7F7;display: flex;justify-content: center;align-items: center;">
- <img src="%s" alt="" style="width: 120px;height: 32px;">
- </div>
- <div class="emailmain_bottom" style="display: flex;flex-direction: column;align-items: center;">
- <p class="emailmain_text" style="margin-top: 32px;width: 100%%;min-height: 72px;font-size: 16px;line-height: 24px;color: #1D1D1D;">
- 尊敬的剑鱼标讯用户:<br> 您好,感谢您使用剑鱼标讯的结构化招标数据产品,免费样例已发送到您的邮箱,请查收!如有问题,可拨打<span style="color: #0987FF;cursor: pointer;">400-108-6670</span>,客服人员将诚挚为您服务。
- </p>
- <div class="download" style="margin-top: 32px; max-width:100%%; height: 30px;display: flex;justify-content: center;align-items: center;">
- <a href="%s" class="download_btn" style="width: 116px;height: 30px;display: flex;text-decoration: none;justify-content: center;align-items: center;font-size: 14px;line-height: 24px;color: #fff;background: #2CB7CA;border-radius: 4px;">下载免费样例 </a>
- </div>
- </div>
- </div>
- <p class="havapro" style="font-size: 14px;height: 24px;color: #686868;margin-top: 32px;">
- 如有问题请<a href="%s" class="click_here" id="click_here" style="color: #0987FF;cursor: pointer;">点击此处</a>,进行意见反馈
- </p>
- </div></div>`, imagesAddress, uploadAddress, feedbackAddress)
- for k, v := range auth {
- if mail.GSendMail("剑鱼标讯", email, "", "", "【剑鱼标讯】结构化招标数据", html, "", "", v) {
- log.Println(email, fmt.Sprintf("使用%s发送邮件成功", v.User))
- return true
- }
- if k < len(auth)-1 {
- log.Println(email, fmt.Sprintf("使用%s发送邮件失败!3s后使用其他邮箱尝试", v.User))
- } else {
- log.Println(email, fmt.Sprintf("使用%s发送邮件失败!", v.User))
- }
- time.Sleep(time.Second * 3)
- }
- } else {
- log.Println(fmt.Sprintf("%s 邮件格式有误", email))
- }
- return false
- }
- func isEmail(value string) bool {
- var emailPattern = regexp.MustCompile("^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$")
- return emailPattern.MatchString(value)
- }
|