Documentation ¶
Index ¶
- type EmailConfig
- type EmailRepo
- type EmailService
- func (es *EmailService) ChangeEmailTemplate(ctx context.Context, changeEmailUrl string) (title, body string, err error)
- func (es *EmailService) GetEmailConfig(ctx context.Context) (ec *EmailConfig, err error)
- func (es *EmailService) NewAnswerTemplate(ctx context.Context, raw *schema.NewAnswerTemplateRawData) (title, body string, err error)
- func (es *EmailService) NewCommentTemplate(ctx context.Context, raw *schema.NewCommentTemplateRawData) (title, body string, err error)
- func (es *EmailService) NewInviteAnswerTemplate(ctx context.Context, raw *schema.NewInviteAnswerTemplateRawData) (title, body string, err error)
- func (es *EmailService) NewQuestionTemplate(ctx context.Context, raw *schema.NewQuestionTemplateRawData) (title, body string, err error)
- func (es *EmailService) PassResetTemplate(ctx context.Context, passResetUrl string) (title, body string, err error)
- func (es *EmailService) RegisterTemplate(ctx context.Context, registerUrl string) (title, body string, err error)
- func (es *EmailService) SaveCode(ctx context.Context, code, codeContent string)
- func (es *EmailService) Send(ctx context.Context, toEmailAddr, subject, body string)
- func (es *EmailService) SendAndSaveCode(ctx context.Context, toEmailAddr, subject, body, code, codeContent string)
- func (es *EmailService) SendAndSaveCodeWithTime(ctx context.Context, toEmailAddr, subject, body, code, codeContent string, ...)
- func (es *EmailService) SetEmailConfig(ctx context.Context, ec *EmailConfig) (err error)
- func (es *EmailService) TestTemplate(ctx context.Context) (title, body string, err error)
- func (es *EmailService) VerifyUrlExpired(ctx context.Context, code string) (content string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EmailConfig ¶
type EmailConfig struct { FromEmail string `json:"from_email"` FromName string `json:"from_name"` SMTPHost string `json:"smtp_host"` SMTPPort int `json:"smtp_port"` Encryption string `json:"encryption"` // "" SSL TLS SMTPUsername string `json:"smtp_username"` SMTPPassword string `json:"smtp_password"` SMTPAuthentication bool `json:"smtp_authentication"` }
EmailConfig email config
func (*EmailConfig) IsSSL ¶
func (e *EmailConfig) IsSSL() bool
func (*EmailConfig) IsTLS ¶ added in v1.3.5
func (e *EmailConfig) IsTLS() bool
type EmailRepo ¶
type EmailRepo interface { SetCode(ctx context.Context, code, content string, duration time.Duration) error VerifyCode(ctx context.Context, code string) (content string, err error) }
EmailRepo email repository
type EmailService ¶
type EmailService struct {
// contains filtered or unexported fields
}
EmailService kit service
func NewEmailService ¶
func NewEmailService( configService *config.ConfigService, emailRepo EmailRepo, siteInfoService siteinfo_common.SiteInfoCommonService, ) *EmailService
NewEmailService email service
func (*EmailService) ChangeEmailTemplate ¶
func (*EmailService) GetEmailConfig ¶
func (es *EmailService) GetEmailConfig(ctx context.Context) (ec *EmailConfig, err error)
func (*EmailService) NewAnswerTemplate ¶
func (es *EmailService) NewAnswerTemplate(ctx context.Context, raw *schema.NewAnswerTemplateRawData) ( title, body string, err error)
NewAnswerTemplate new answer template
func (*EmailService) NewCommentTemplate ¶
func (es *EmailService) NewCommentTemplate(ctx context.Context, raw *schema.NewCommentTemplateRawData) ( title, body string, err error)
NewCommentTemplate new comment template
func (*EmailService) NewInviteAnswerTemplate ¶
func (es *EmailService) NewInviteAnswerTemplate(ctx context.Context, raw *schema.NewInviteAnswerTemplateRawData) ( title, body string, err error)
NewInviteAnswerTemplate new invite answer template
func (*EmailService) NewQuestionTemplate ¶
func (es *EmailService) NewQuestionTemplate(ctx context.Context, raw *schema.NewQuestionTemplateRawData) ( title, body string, err error)
NewQuestionTemplate new question template
func (*EmailService) PassResetTemplate ¶
func (*EmailService) RegisterTemplate ¶
func (*EmailService) SaveCode ¶
func (es *EmailService) SaveCode(ctx context.Context, code, codeContent string)
SaveCode save code
func (*EmailService) Send ¶
func (es *EmailService) Send(ctx context.Context, toEmailAddr, subject, body string)
Send email send
func (*EmailService) SendAndSaveCode ¶
func (es *EmailService) SendAndSaveCode(ctx context.Context, toEmailAddr, subject, body, code, codeContent string)
SendAndSaveCode send email and save code
func (*EmailService) SendAndSaveCodeWithTime ¶
func (es *EmailService) SendAndSaveCodeWithTime( ctx context.Context, toEmailAddr, subject, body, code, codeContent string, duration time.Duration)
SendAndSaveCodeWithTime send email and save code
func (*EmailService) SetEmailConfig ¶
func (es *EmailService) SetEmailConfig(ctx context.Context, ec *EmailConfig) (err error)
SetEmailConfig set email config
func (*EmailService) TestTemplate ¶
func (es *EmailService) TestTemplate(ctx context.Context) (title, body string, err error)
TestTemplate send test email template parse
func (*EmailService) VerifyUrlExpired ¶
func (es *EmailService) VerifyUrlExpired(ctx context.Context, code string) (content string)
VerifyUrlExpired email send
Click to show internal directories.
Click to hide internal directories.