emailqueue.go 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. // Copyright 2019 Yunion
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package notify
  15. import (
  16. "time"
  17. "yunion.io/x/jsonutils"
  18. "yunion.io/x/onecloud/pkg/apis"
  19. )
  20. type SEmailMessage struct {
  21. To []string `json:"to"`
  22. Cc []string `json:"cc"`
  23. Bcc []string `json:"bcc"`
  24. Subject string `json:"subject"`
  25. Body string `json:"body"`
  26. Attachments []SEmailAttachment `json:"attachments"`
  27. }
  28. type SEmailAttachment struct {
  29. Filename string `json:"filename"`
  30. Mime string `json:"mime"`
  31. Base64Content string `json:"content"`
  32. }
  33. type SEmailConfig struct {
  34. Hostname string `json:"hostname"`
  35. Hostport int `json:"hostport"`
  36. Username string `json:"username"`
  37. Password string `json:"password"`
  38. SenderAddress string `json:"sender_address"`
  39. SslGlobal bool `json:"ssl_global"`
  40. }
  41. type EmailQueueCreateInput struct {
  42. SEmailMessage
  43. // swagger:ignore
  44. Dest string `json:"dest"`
  45. // swagger:ignore
  46. DestCc string `json:"dest_cc"`
  47. // swagger:ignore
  48. DestBcc string `json:"dest_bcc"`
  49. // swagger:ignore
  50. Content jsonutils.JSONObject `json:"content"`
  51. // swagger:ignore
  52. ProjectId string `json:"project_id"`
  53. // swagger:ignore
  54. Project string `json:"project"`
  55. // swagger:ignore
  56. ProjectDomainId string `json:"project_domain_id"`
  57. // swagger:ignore
  58. ProjectDomain string `json:"project_domain"`
  59. // swagger:ignore
  60. UserId string `json:"user_id"`
  61. // swagger:ignore
  62. User string `json:"user"`
  63. // swagger:ignore
  64. DomainId string `json:"domain_id"`
  65. // swagger:ignore
  66. Domain string `json:"domain"`
  67. // swagger:ignore
  68. Roles string `json:"roles"`
  69. MoreDetails map[string]string `json:"more_datails"`
  70. SessionId string `json:"session_id"`
  71. }
  72. type EmailQueueListInput struct {
  73. apis.LogBaseListInput
  74. // Id []int `json:"id"`
  75. To []string `json:"to"`
  76. Subject string `json:"subject"`
  77. SessionId []string `json:"session_id"`
  78. }
  79. const (
  80. EmailQueued = "queued"
  81. EmailSending = "sending"
  82. EmailSuccess = "success"
  83. EmailFail = "fail"
  84. )
  85. type EmailQueueSendInput struct {
  86. Sync bool `json:"sync"`
  87. }
  88. type EmailQueueDetails struct {
  89. apis.ModelBaseDetails
  90. SEmailQueue
  91. SentAt time.Time `json:"sent_at"`
  92. Status string `json:"status"`
  93. Results string `json:"results"`
  94. }