email

package
v6.0.0-...-cfe9101 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2024 License: AGPL-3.0, Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TokenTypePasswordRecovery = "password_recovery"
	TokenTypeVerifyEmail      = "verify_email"
	TokenTypeTeamInvitation   = "team_invitation"
	TokenTypeGuestInvitation  = "guest_invitation"
	TokenTypeCWSAccess        = "cws_access_token"
)
View Source
const (
	EmailBatchingTaskName = "Email Batching"
)

Variables

View Source
var (
	CreateEmailTokenError  = errors.New("could not create token")
	NoRateLimiterError     = errors.New("the rate limit could not be found")
	SetupRateLimiterError  = errors.New("the rate limiter could not be set")
	RateLimitExceededError = errors.New("the rate limit is exceeded")
	SendMailError          = errors.New("could not send the email")
)

Functions

This section is empty.

Types

type EmailBatchingJob

type EmailBatchingJob struct {
	// contains filtered or unexported fields
}

func NewEmailBatchingJob

func NewEmailBatchingJob(es *Service, bufferSize int) *EmailBatchingJob

func (*EmailBatchingJob) Add

func (job *EmailBatchingJob) Add(user *model.User, post *model.Post, team *model.Team) bool

func (*EmailBatchingJob) CheckPendingEmails

func (job *EmailBatchingJob) CheckPendingEmails()

func (*EmailBatchingJob) Start

func (job *EmailBatchingJob) Start()

type Service

type Service struct {
	EmailBatching *EmailBatchingJob
	// contains filtered or unexported fields
}

func NewService

func NewService(config ServiceConfig) (*Service, error)

func (*Service) AddNotificationEmailToBatch

func (es *Service) AddNotificationEmailToBatch(user *model.User, post *model.Post, team *model.Team) *model.AppError

func (*Service) CreateVerifyEmailToken

func (es *Service) CreateVerifyEmailToken(userID string, newEmail string) (*model.Token, error)

func (*Service) GetMessageForNotification

func (es *Service) GetMessageForNotification(post *model.Post, translateFunc i18n.TranslateFunc) string

func (*Service) GetPerDayEmailRateLimiter

func (es *Service) GetPerDayEmailRateLimiter() *throttled.GCRARateLimiter

func (*Service) GetPerHourEmailRateLimiter

func (es *Service) GetPerHourEmailRateLimiter() *throttled.GCRARateLimiter

func (*Service) InitEmailBatching

func (es *Service) InitEmailBatching()

func (*Service) InvalidateVerifyEmailTokensForUser

func (es *Service) InvalidateVerifyEmailTokensForUser(userID string) *model.AppError

func (*Service) NewEmailTemplateData

func (es *Service) NewEmailTemplateData(locale string) templates.Data

func (*Service) SendChangeUsernameEmail

func (es *Service) SendChangeUsernameEmail(newUsername, email, locale, siteURL string) error

func (*Service) SendCloudTrialEndWarningEmail

func (es *Service) SendCloudTrialEndWarningEmail(userEmail, name, trialEndDate, locale, siteURL string) error

func (*Service) SendCloudTrialEndedEmail

func (es *Service) SendCloudTrialEndedEmail(userEmail, name, locale, siteURL string) error

func (*Service) SendCloudWelcomeEmail

func (es *Service) SendCloudWelcomeEmail(userEmail, locale, teamInviteID, workSpaceName, dns, siteURL string) error

SendCloudWelcomeEmail sends the cloud version of the welcome email

func (*Service) SendDeactivateAccountEmail

func (es *Service) SendDeactivateAccountEmail(email string, locale, siteURL string) error

func (*Service) SendEmailChangeEmail

func (es *Service) SendEmailChangeEmail(oldEmail, newEmail, locale, siteURL string) error

func (*Service) SendEmailChangeVerifyEmail

func (es *Service) SendEmailChangeVerifyEmail(newUserEmail, locale, siteURL, token string) error

func (*Service) SendGuestInviteEmails

func (es *Service) SendGuestInviteEmails(team *model.Team, channels []*model.Channel, senderName string, senderUserId string, senderProfileImage []byte, invites []string, siteURL string, message string, errorWhenNotSent bool) error

func (*Service) SendInviteEmails

func (es *Service) SendInviteEmails(team *model.Team, senderName string, senderUserId string, invites []string, siteURL string, reminderData *model.TeamInviteReminderData, errorWhenNotSent bool) error

func (*Service) SendInviteEmailsToTeamAndChannels

func (es *Service) SendInviteEmailsToTeamAndChannels(
	team *model.Team,
	channels []*model.Channel,
	senderName string,
	senderUserId string,
	senderProfileImage []byte,
	invites []string,
	siteURL string,
	reminderData *model.TeamInviteReminderData,
	message string,
	errorWhenNotSent bool,
) ([]*model.EmailInviteWithError, error)

func (*Service) SendLicenseInactivityEmail

func (es *Service) SendLicenseInactivityEmail(email, name, locale, siteURL string) error

func (*Service) SendLicenseUpForRenewalEmail

func (es *Service) SendLicenseUpForRenewalEmail(email, name, locale, siteURL, renewalLink string, daysToExpiration int) error

func (*Service) SendMailWithEmbeddedFiles

func (es *Service) SendMailWithEmbeddedFiles(to, subject, htmlBody string, embeddedFiles map[string]io.Reader) error

func (*Service) SendMfaChangeEmail

func (es *Service) SendMfaChangeEmail(email string, activated bool, locale, siteURL string) error

func (*Service) SendNoCardPaymentFailedEmail

func (es *Service) SendNoCardPaymentFailedEmail(email string, locale string, siteURL string) error

func (*Service) SendNotificationMail

func (es *Service) SendNotificationMail(to, subject, htmlBody string) error

func (*Service) SendPasswordChangeEmail

func (es *Service) SendPasswordChangeEmail(email, method, locale, siteURL string) error

func (*Service) SendPasswordResetEmail

func (es *Service) SendPasswordResetEmail(email string, token *model.Token, locale, siteURL string) (bool, error)

func (*Service) SendPaymentFailedEmail

func (es *Service) SendPaymentFailedEmail(email string, locale string, failedPayment *model.FailedPayment, siteURL string) (bool, error)

func (*Service) SendRemoveExpiredLicenseEmail

func (es *Service) SendRemoveExpiredLicenseEmail(renewalLink, email string, locale, siteURL string) error

SendRemoveExpiredLicenseEmail formats an email and uses the email service to send the email to user with link pointing to CWS to renew the user license

func (*Service) SendSignInChangeEmail

func (es *Service) SendSignInChangeEmail(email, method, locale, siteURL string) error

func (*Service) SendUserAccessTokenAddedEmail

func (es *Service) SendUserAccessTokenAddedEmail(email, locale, siteURL string) error

func (*Service) SendVerifyEmail

func (es *Service) SendVerifyEmail(userEmail, locale, siteURL, token, redirect string) error

func (*Service) SendWelcomeEmail

func (es *Service) SendWelcomeEmail(userID string, email string, verified bool, disableWelcomeEmail bool, locale, siteURL, redirect string) error

type ServiceConfig

type ServiceConfig struct {
	ConfigFn  func() *model.Config
	LicenseFn func() *model.License
	GoFn      func(f func())

	TemplatesContainer *templates.Container
	UserService        *users.UserService
	Store              store.Store
}

type ServiceInterface

type ServiceInterface interface {
	GetPerDayEmailRateLimiter() *throttled.GCRARateLimiter
	NewEmailTemplateData(locale string) templates.Data
	SendEmailChangeVerifyEmail(newUserEmail, locale, siteURL, token string) error
	SendEmailChangeEmail(oldEmail, newEmail, locale, siteURL string) error
	SendVerifyEmail(userEmail, locale, siteURL, token, redirect string) error
	SendSignInChangeEmail(email, method, locale, siteURL string) error
	SendWelcomeEmail(userID string, email string, verified bool, disableWelcomeEmail bool, locale, siteURL, redirect string) error
	SendCloudTrialEndWarningEmail(userEmail, name, trialEndDate, locale, siteURL string) error
	SendCloudTrialEndedEmail(userEmail, name, locale, siteURL string) error
	SendCloudWelcomeEmail(userEmail, locale, teamInviteID, workSpaceName, dns, siteURL string) error
	SendPasswordChangeEmail(email, method, locale, siteURL string) error
	SendUserAccessTokenAddedEmail(email, locale, siteURL string) error
	SendPasswordResetEmail(email string, token *model.Token, locale, siteURL string) (bool, error)
	SendMfaChangeEmail(email string, activated bool, locale, siteURL string) error
	SendInviteEmails(team *model.Team, senderName string, senderUserId string, invites []string, siteURL string, reminderData *model.TeamInviteReminderData, errorWhenNotSent bool) error
	SendGuestInviteEmails(team *model.Team, channels []*model.Channel, senderName string, senderUserId string, senderProfileImage []byte, invites []string, siteURL string, message string, errorWhenNotSent bool) error
	SendInviteEmailsToTeamAndChannels(team *model.Team, channels []*model.Channel, senderName string, senderUserId string, senderProfileImage []byte, invites []string, siteURL string, reminderData *model.TeamInviteReminderData, message string, errorWhenNotSent bool) ([]*model.EmailInviteWithError, error)
	SendDeactivateAccountEmail(email string, locale, siteURL string) error
	SendNotificationMail(to, subject, htmlBody string) error
	SendMailWithEmbeddedFiles(to, subject, htmlBody string, embeddedFiles map[string]io.Reader) error
	SendLicenseUpForRenewalEmail(email, name, locale, siteURL, renewalLink string, daysToExpiration int) error
	SendPaymentFailedEmail(email string, locale string, failedPayment *model.FailedPayment, siteURL string) (bool, error)
	SendNoCardPaymentFailedEmail(email string, locale string, siteURL string) error
	SendRemoveExpiredLicenseEmail(renewalLink, email string, locale, siteURL string) error
	AddNotificationEmailToBatch(user *model.User, post *model.Post, team *model.Team) *model.AppError
	GetMessageForNotification(post *model.Post, translateFunc i18n.TranslateFunc) string
	InitEmailBatching()
	SendChangeUsernameEmail(newUsername, email, locale, siteURL string) error
	CreateVerifyEmailToken(userID string, newEmail string) (*model.Token, error)
	SendLicenseInactivityEmail(email, name, locale, siteURL string) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL