aliyun_email.go 681 B

123456789101112131415161718192021222324252627
  1. package services
  2. import (
  3. "eta_gn/eta_api/utils"
  4. openapi "github.com/alibabacloud-go/darabonba-openapi/v2/client"
  5. dm "github.com/alibabacloud-go/dm-20151123/v2/client"
  6. "github.com/alibabacloud-go/tea/tea"
  7. )
  8. // AliyunEmail 阿里云邮件
  9. type AliyunEmail struct {
  10. Client *dm.Client
  11. }
  12. // NewClient 创建新的链接
  13. func (em *AliyunEmail) NewClient() (err error) {
  14. config := &openapi.Config{
  15. AccessKeyId: tea.String(utils.AliyunEmailAccessKeyId),
  16. AccessKeySecret: tea.String(utils.AliyunEmailAccessKeySecret),
  17. }
  18. // 访问的域名
  19. config.Endpoint = tea.String("dm.aliyuncs.com")
  20. _result, _err := dm.NewClient(config)
  21. em.Client = _result
  22. err = _err
  23. return
  24. }