structed.go 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package public
  2. import (
  3. "fmt"
  4. "log"
  5. "time"
  6. "app.yhyue.com/moapp/jybase/mail"
  7. )
  8. func SendStructedDataByEmail(email string, auth []*mail.GmailAuth, Sysconfig, Seoconfig map[string]interface{}) bool {
  9. var uploadAddress = Sysconfig["webdomain"].(string) + Seoconfig["structedUploadA"].(string)
  10. var imagesAddress = Sysconfig["webdomain"].(string) + "/structuredata/mobile/image/emaillogo.png"
  11. var feedbackAddress = "mailto:bd@topnet.net.cn"
  12. if isEmail(email) {
  13. html := fmt.Sprintf(`<div style="width:100%%;display: flex;justify-content: center;">
  14. <div class="Email" id="Email" style="max-width:100%%;min-height: 540px;display: flex;flex-direction: column;align-items: center;">
  15. <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;">
  16. <div class="emailmain_top" style="height: 88px;max-width:100%%;border-bottom: 1px solid #F7F7F7;display: flex;justify-content: center;align-items: center;">
  17. <img src="%s" alt="" style="width: 120px;height: 32px;">
  18. </div>
  19. <div class="emailmain_bottom" style="display: flex;flex-direction: column;align-items: center;">
  20. <p class="emailmain_text" style="margin-top: 32px;width: 100%%;min-height: 72px;font-size: 16px;line-height: 24px;color: #1D1D1D;">
  21. 尊敬的剑鱼标讯用户:<br> 您好,感谢您使用剑鱼标讯的结构化招标数据产品,免费样例已发送到您的邮箱,请查收!如有问题,可拨打<span style="color: #0987FF;cursor: pointer;">400-108-6670</span>,客服人员将诚挚为您服务。
  22. </p>
  23. <div class="download" style="margin-top: 32px; max-width:100%%; height: 30px;display: flex;justify-content: center;align-items: center;">
  24. <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>
  25. </div>
  26. </div>
  27. </div>
  28. <p class="havapro" style="font-size: 14px;height: 24px;color: #686868;margin-top: 32px;">
  29. 如有问题请<a href="%s" class="click_here" id="click_here" style="color: #0987FF;cursor: pointer;">点击此处</a>,进行意见反馈
  30. </p>
  31. </div></div>`, imagesAddress, uploadAddress, feedbackAddress)
  32. for k, v := range auth {
  33. if mail.GSendMail("剑鱼标讯", email, "", "", "【剑鱼标讯】结构化招标数据", html, "", "", v) {
  34. log.Println(email, fmt.Sprintf("使用%s发送邮件成功", v.User))
  35. return true
  36. }
  37. if k < len(auth)-1 {
  38. log.Println(email, fmt.Sprintf("使用%s发送邮件失败!3s后使用其他邮箱尝试", v.User))
  39. } else {
  40. log.Println(email, fmt.Sprintf("使用%s发送邮件失败!", v.User))
  41. }
  42. time.Sleep(time.Second * 3)
  43. }
  44. } else {
  45. log.Println(fmt.Sprintf("%s 邮件格式有误", email))
  46. }
  47. return false
  48. }