Documentation
¶
Overview ¶
Package mails implements various helper methods for sending user and admin emails like forgotten password, verification, etc.
Index ¶
- func SendRecordChangeEmail(app core.App, record *recordmodels.Record, newEmail string) error
- func SendRecordPasswordLoginAlert(app core.App, authRecord *recordmodels.Record, providerNames ...string) error
- func SendRecordPasswordReset(app core.App, authRecord *recordmodels.Record) error
- func SendRecordVerification(app core.App, authRecord *recordmodels.Record) error
- type MailService
- type MailServiceConfig
- type Message
- type Runtime
- type Service
- func (s *Service) SendRecordChangeEmail(record *recordmodels.Record, newEmail string) error
- func (s *Service) SendRecordPasswordLoginAlert(authRecord *recordmodels.Record, providerNames ...string) error
- func (s *Service) SendRecordPasswordReset(authRecord *recordmodels.Record) error
- func (s *Service) SendRecordVerification(authRecord *recordmodels.Record) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SendRecordChangeEmail ¶
SendRecordChangeEmail sends a change email confirmation email to the specified user.
func SendRecordPasswordLoginAlert ¶
func SendRecordPasswordLoginAlert(app core.App, authRecord *recordmodels.Record, providerNames ...string) error
SendRecordPasswordLoginAlert sends an OAuth2 password login alert to the specified auth record.
func SendRecordPasswordReset ¶
func SendRecordPasswordReset(app core.App, authRecord *recordmodels.Record) error
SendRecordPasswordReset sends a password reset request email to the specified user.
func SendRecordVerification ¶
func SendRecordVerification(app core.App, authRecord *recordmodels.Record) error
SendRecordVerification sends a verification request email to the specified user.
Types ¶
type MailService ¶
type MailService struct {
// contains filtered or unexported fields
}
MailService handles Gmail integration and operations
func NewMailService ¶
func NewMailService() *MailService
NewMailService creates a new MailService instance with configuration from environment variables
func NewMailServiceWithApp ¶
func NewMailServiceWithApp(app core.App) *MailService
func (*MailService) FetchClient ¶
FetchClient retrieves an authenticated HTTP client for a given token ID.
func (*MailService) GetAuthUrl ¶
func (ms *MailService) GetAuthUrl() string
GetAuthUrl generates an OAuth authorization URL for Gmail authentication
func (*MailService) GetConfig ¶
func (ms *MailService) GetConfig() *oauth2.Config
GetConfig returns the OAuth2 configuration
func (*MailService) GetGmailService ¶
func (ms *MailService) GetGmailService(ctx context.Context, client *http.Client) (*gmail.Service, error)
GetGmailService creates a Gmail API service client using the provided HTTP client.
type MailServiceConfig ¶
func ConfigFromEnv ¶
func ConfigFromEnv() MailServiceConfig
func ConfigFromSettings ¶
func ConfigFromSettings(app core.App) MailServiceConfig
func ConfigFromSettingsModel ¶
func ConfigFromSettingsModel(settings settingsmodels.MailConfig) MailServiceConfig
func DefaultConfig ¶
func DefaultConfig() MailServiceConfig
func ResolveConfig ¶
func ResolveConfig(app core.App) MailServiceConfig
type Message ¶
func NewMessage ¶
func NewMessage() *Message
type Runtime ¶
type Runtime struct{}
Runtime holds mutable mails-related state.
The module currently mostly contains integration helpers and templates. Runtime is kept as a placeholder for future background sync and caches.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service handles transactional emails.
func (*Service) SendRecordChangeEmail ¶
func (s *Service) SendRecordChangeEmail(record *recordmodels.Record, newEmail string) error
SendRecordChangeEmail sends a change email confirmation email to the specified user.
func (*Service) SendRecordPasswordLoginAlert ¶
func (s *Service) SendRecordPasswordLoginAlert(authRecord *recordmodels.Record, providerNames ...string) error
SendRecordPasswordLoginAlert sends an OAuth2 password login alert to the specified auth record.
func (*Service) SendRecordPasswordReset ¶
func (s *Service) SendRecordPasswordReset(authRecord *recordmodels.Record) error
SendRecordPasswordReset sends a password reset request email to the specified user.
func (*Service) SendRecordVerification ¶
func (s *Service) SendRecordVerification(authRecord *recordmodels.Record) error
SendRecordVerification sends a verification request email to the specified user.