Documentation
¶
Index ¶
- Constants
- func NewLoginAuth(username, password string) smtp.Auth
- func NewMailAddress(email string) mail.Address
- func SetContentByIDFunc(f func(id string) (data []byte, contentType string, name string, err error))
- func SetEmailPropertyData(e *EmailPropertyData)
- func SetMailManager(mailManager IMailManager)
- type AClientSMTP
- func (cn *AClientSMTP) CloseConnection() error
- func (cn *AClientSMTP) GetAddress() string
- func (cn *AClientSMTP) GetPassword() string
- func (cn *AClientSMTP) GetSender() (enmime.Sender, error)
- func (cn *AClientSMTP) GetUsername() string
- func (cn *AClientSMTP) HasInitialized() bool
- func (cn *AClientSMTP) OpenConnection() error
- func (cn *AClientSMTP) SendMail(mailPiece *MailPiece) error
- func (cn *AClientSMTP) Test() (bool, aconns.TestStatus, error)
- func (cn *AClientSMTP) Validate() error
- type AClientSMTPs
- type Attachment
- func (att *Attachment) Clone() *Attachment
- func (a *Attachment) GetContent() ([]byte, error)
- func (a *Attachment) GetContentType() string
- func (a *Attachment) GetEnmimePart() *enmime.Part
- func (a *Attachment) GetName() string
- func (a *Attachment) HasEnmimePart() bool
- func (a *Attachment) LoadContent() error
- func (a *Attachment) SetContentFromBytes(data []byte)
- func (a *Attachment) SetEnmimePart(part *enmime.Part)
- func (a *Attachment) Validate() error
- type AttachmentKey
- func (ak AttachmentKey) GetParts() (key AttachmentKey, target string, err error)
- func (ak AttachmentKey) IsEmpty() bool
- func (ak AttachmentKey) IsFile() bool
- func (ak AttachmentKey) IsId() bool
- func (ak AttachmentKey) Matches(s string) bool
- func (ak AttachmentKey) String() string
- func (ak AttachmentKey) ToStringTrimLower() string
- func (ak AttachmentKey) TrimSpace() AttachmentKey
- func (ak AttachmentKey) Validate() error
- type AttachmentKeys
- func (aks AttachmentKeys) Find(ak AttachmentKey) AttachmentKey
- func (aks AttachmentKeys) HasKey(s AttachmentKey) bool
- func (aks AttachmentKeys) IsEmpty() bool
- func (aks AttachmentKeys) Matches(s string) bool
- func (aks AttachmentKeys) String() string
- func (aks AttachmentKeys) ToStringArray() []string
- type Attachments
- type AuthType
- type AuthTypes
- type CustomSMTPSender
- type DialMode
- type DialModes
- type EmailPropertyData
- type IMailManager
- type ISBAdapterSMTP
- type ISMTPAuth
- type MailAddressGroup
- func NewMAG(from mail.Address, to []mail.Address, cc []mail.Address, bcc []mail.Address) *MailAddressGroup
- func NewMAGWithBCC(from mail.Address, bcc []mail.Address) *MailAddressGroup
- func NewMAGWithBCCString(from string, bcc []string) *MailAddressGroup
- func NewMAGWithCC(from mail.Address, cc []mail.Address) *MailAddressGroup
- func NewMAGWithCCString(from string, cc []string) *MailAddressGroup
- func NewMAGWithSingleToAndCCBCC(from mail.Address, to mail.Address, cc []mail.Address, bcc []mail.Address) *MailAddressGroup
- func NewMAGWithTo(from mail.Address, to mail.Address) *MailAddressGroup
- func NewMAGWithToAndBCC(from mail.Address, to mail.Address, bcc []mail.Address) *MailAddressGroup
- func NewMAGWithToAndCC(from mail.Address, to mail.Address, cc []mail.Address) *MailAddressGroup
- func NewMAGWithToCCBCCString(from string, to string, cc []string, bcc []string) *MailAddressGroup
- func NewMAGWithToString(from string, to string) *MailAddressGroup
- type MailManager
- func (mm *MailManager) FindTemplate(templateName MailTemplateName) *MailTemplate
- func (mm *MailManager) SendWithRender(templateName MailTemplateName, mergeAddressGroup *MailAddressGroup, ...) error
- func (mm *MailManager) SendWithRenderOptions(templateName MailTemplateName, smtpAuth ISMTPAuth, ...) error
- func (mm *MailManager) Validate() error
- type MailPiece
- type MailTemplate
- type MailTemplateMap
- type MailTemplateName
- type MailTemplateNames
- func (mtns MailTemplateNames) Find(mtn MailTemplateName) MailTemplateName
- func (mtns MailTemplateNames) HasKey(s MailTemplateName) bool
- func (mtns MailTemplateNames) IsEmpty() bool
- func (mtns MailTemplateNames) Matches(s string) bool
- func (mtns MailTemplateNames) String() string
- func (mtns MailTemplateNames) ToStringArray() []string
- type MailTemplates
Constants ¶
const ( ADAPTERTYPE_SMTP = aconns.AdapterType("smtp") SMTP_DEFAULT_PORT = 587 SMTP_CONNECTION_TIMEOUT = 30 AUTHTYPE_SENDER_NONE = "none" AUTHTYPE_SENDER_PLAIN = "plain" AUTHTYPE_SENDER_IDENTITY = "identity" )
const MAIL_MANAGER_SMTP_DEFAULT aconns.AdapterName = "default"
Variables ¶
This section is empty.
Functions ¶
func NewLoginAuth ¶
NewLoginAuth creates a new instance of loginAuth with the provided username and password
func NewMailAddress ¶
NewMailAddress creates a new mail.Address with only the Address string. The Name field remains empty.
func SetContentByIDFunc ¶
func SetContentByIDFunc(f func(id string) (data []byte, contentType string, name string, err error))
SetContentByIDFunc sets the global function to retrieve content by ID
func SetEmailPropertyData ¶
func SetEmailPropertyData(e *EmailPropertyData)
func SetMailManager ¶
func SetMailManager(mailManager IMailManager)
Types ¶
type AClientSMTP ¶
type AClientSMTP struct { aconns.Adapter Username string `json:"username,omitempty"` Password string `json:"password,omitempty"` PasswordFile string `json:"passwordFile,omitempty"` // Loaded once then deleted when the password is populated. Identity string `json:"identity,omitempty"` ConnectionTimeout int `json:"connectionTimeout,omitempty"` InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty"` DialMode DialMode `json:"dialMode,omitempty"` AuthType AuthType `json:"authType,omitempty"` AllowEmptySubject bool `json:"allowEmptySubject,omitempty"` AllowNoTextHMTL bool `json:"allowNoTextHMTL,omitempty"` AllowAttachments bool `json:"allowAttachments,omitempty"` // contains filtered or unexported fields }
AClientSMTP represents an SMTP client with connection details.
func (*AClientSMTP) CloseConnection ¶
func (cn *AClientSMTP) CloseConnection() error
CloseConnection is a no-op method to satisfy the interface requirements.
func (*AClientSMTP) GetAddress ¶
func (cn *AClientSMTP) GetAddress() string
GetAddress returns the full address plus port of the SMTP server.
func (*AClientSMTP) GetPassword ¶
func (cn *AClientSMTP) GetPassword() string
GetPassword returns the password of the database connection.
func (*AClientSMTP) GetSender ¶
func (cn *AClientSMTP) GetSender() (enmime.Sender, error)
GetSender safely acquires the necessary lock and calls getSenderNoLock.
func (*AClientSMTP) GetUsername ¶
func (cn *AClientSMTP) GetUsername() string
GetUsername returns the username of the database connection.
func (*AClientSMTP) HasInitialized ¶
func (cn *AClientSMTP) HasInitialized() bool
HasInitialized determines if the SMTP struct and auth have been validated.
func (*AClientSMTP) OpenConnection ¶
func (cn *AClientSMTP) OpenConnection() error
OpenConnection verifies and initializes the SMTP connection.
func (*AClientSMTP) SendMail ¶
func (cn *AClientSMTP) SendMail(mailPiece *MailPiece) error
func (*AClientSMTP) Test ¶
func (cn *AClientSMTP) Test() (bool, aconns.TestStatus, error)
Test attempts to validate the AClientSMTP, open a connection if necessary, and test the connection.
func (*AClientSMTP) Validate ¶
func (cn *AClientSMTP) Validate() error
Validate checks if the AClientSMTP object is valid.
type AClientSMTPs ¶
type AClientSMTPs []*AClientSMTP
func (AClientSMTPs) FindByName ¶
func (cns AClientSMTPs) FindByName(name aconns.AdapterName) *AClientSMTP
type Attachment ¶
type Attachment struct { Key AttachmentKey `json:"key,omitempty"` ContentType string `json:"contentType"` // Content-Type Name string `json:"name"` //Filename string `json:"filename"` // stored as base64, using base64.RawStdEncoding // https://golangbyexample.com/base64-golang/ Content string `json:"content,omitempty"` // contains filtered or unexported fields }
Attachment can be used instead of enmime.Part. Why? Because different systems will store attachments differently. This attachment struct offers various ways to do so. If Key is ATTACHMENTKEY_NONE, then the Content is encoded directly as base64. If Key is ATTACHMENTKEY_FILE, then the target from key.GetParts() contains the file to load into Content. If Key is ATTACHMENTKEY_ID, then the target from key.GetParts() contains the id your app maps to content within your system.
func (*Attachment) Clone ¶
func (att *Attachment) Clone() *Attachment
Clone creates a deep copy of an Attachment, including its enmime.Part if necessary.
func (*Attachment) GetContent ¶
func (a *Attachment) GetContent() ([]byte, error)
GetContent returns the content based on the enmime.Part if it is set
func (*Attachment) GetContentType ¶
func (a *Attachment) GetContentType() string
GetContentType returns the content type based on the enmime.Part if it is set
func (*Attachment) GetEnmimePart ¶
func (a *Attachment) GetEnmimePart() *enmime.Part
GetEnmimePart returns the enmime.Part if it is set
func (*Attachment) GetName ¶
func (a *Attachment) GetName() string
GetName returns the name based on the enmime.Part if it is set
func (*Attachment) HasEnmimePart ¶
func (a *Attachment) HasEnmimePart() bool
HasEnmimePart checks if the enmime.Part is set
func (*Attachment) LoadContent ¶
func (a *Attachment) LoadContent() error
LoadContent loads the content based on the AttachmentKey
func (*Attachment) SetContentFromBytes ¶
func (a *Attachment) SetContentFromBytes(data []byte)
SetContentFromBytes sets the content from a byte array and encodes it as base64
func (*Attachment) SetEnmimePart ¶
func (a *Attachment) SetEnmimePart(part *enmime.Part)
SetEnmimePart sets the enmime.Part for the attachment
func (*Attachment) Validate ¶
func (a *Attachment) Validate() error
type AttachmentKey ¶
type AttachmentKey string
AttachmentKey represents an attachment key type
const ( ATTACHMENTKEY_NONE AttachmentKey = "" ATTACHMENTKEY_FILE AttachmentKey = "file" ATTACHMENTKEY_ID AttachmentKey = "id" )
Predefined AttachmentKeys
func (AttachmentKey) GetParts ¶
func (ak AttachmentKey) GetParts() (key AttachmentKey, target string, err error)
GetParts splits the AttachmentKey into its key and target parts
func (AttachmentKey) IsEmpty ¶
func (ak AttachmentKey) IsEmpty() bool
IsEmpty checks if the AttachmentKey is empty
func (AttachmentKey) IsFile ¶
func (ak AttachmentKey) IsFile() bool
IsFile checks if the AttachmentKey has the "file" prefix
func (AttachmentKey) IsId ¶
func (ak AttachmentKey) IsId() bool
IsId checks if the AttachmentKey has the "id" prefix
func (AttachmentKey) Matches ¶
func (ak AttachmentKey) Matches(s string) bool
Matches checks if the AttachmentKey matches the given string
func (AttachmentKey) String ¶
func (ak AttachmentKey) String() string
String returns the string representation of the AttachmentKey
func (AttachmentKey) ToStringTrimLower ¶
func (ak AttachmentKey) ToStringTrimLower() string
ToStringTrimLower returns the trimmed and lowercased string representation of the AttachmentKey
func (AttachmentKey) TrimSpace ¶
func (ak AttachmentKey) TrimSpace() AttachmentKey
TrimSpace returns the trimmed string representation of the AttachmentKey
func (AttachmentKey) Validate ¶
func (ak AttachmentKey) Validate() error
Validate checks if the AttachmentKey is valid
type AttachmentKeys ¶
type AttachmentKeys []AttachmentKey
AttachmentKeys represents a slice of AttachmentKey
func (AttachmentKeys) Find ¶
func (aks AttachmentKeys) Find(ak AttachmentKey) AttachmentKey
Find returns the AttachmentKey if found, otherwise an empty AttachmentKey
func (AttachmentKeys) HasKey ¶
func (aks AttachmentKeys) HasKey(s AttachmentKey) bool
HasKey checks if the AttachmentKeys slice contains the given AttachmentKey
func (AttachmentKeys) IsEmpty ¶
func (aks AttachmentKeys) IsEmpty() bool
IsEmpty checks if the AttachmentKeys slice is empty
func (AttachmentKeys) Matches ¶
func (aks AttachmentKeys) Matches(s string) bool
Matches checks if any AttachmentKey in the AttachmentKeys slice matches the given string
func (AttachmentKeys) String ¶
func (aks AttachmentKeys) String() string
String returns the string representation of the AttachmentKeys slice
func (AttachmentKeys) ToStringArray ¶
func (aks AttachmentKeys) ToStringArray() []string
ToStringArray returns an array of AttachmentKeys as strings
type Attachments ¶
type Attachments []*Attachment
func (*Attachments) AddAttachmentFromFile ¶
func (as *Attachments) AddAttachmentFromFile(filePath string) error
AddAttachmentFromFile creates a new Attachment from a file and adds it to the Attachments slice
func (*Attachments) AddAttachmentsFromDirectory ¶
func (as *Attachments) AddAttachmentsFromDirectory(dirPath string) error
AddAttachmentsFromDirectory creates new Attachments from all files in a directory and adds them to the Attachments slice
func (Attachments) Clone ¶
func (as Attachments) Clone() Attachments
Clone creates a deep copy of the Attachments slice, which contains Attachment elements.
type AuthType ¶
type AuthType string
AuthType represents an authentication type
func (AuthType) ToStringTrimLower ¶
ToStringTrimLower returns the trimmed and lowercased string representation of the AuthType
type AuthTypes ¶
type AuthTypes []AuthType
AuthTypes represents a slice of AuthType
func (AuthTypes) Matches ¶
Matches checks if any AuthType in the AuthTypes slice matches the given string
func (AuthTypes) ToStringArray ¶
ToStringArray returns an array of AuthTypes as strings
type CustomSMTPSender ¶
type CustomSMTPSender struct {
// contains filtered or unexported fields
}
CustomSMTPSender supports multiple SMTP connection modes and auto-detects the connection type.
func NewCustomSMTPSender ¶
func NewCustomSMTPSender(addr string, auth smtp.Auth, tlsConfig *tls.Config, timeout time.Duration, mode DialMode) *CustomSMTPSender
NewCustomSMTPSender creates a new CustomSMTPSender with optional connection mode.
func (*CustomSMTPSender) Send ¶
func (s *CustomSMTPSender) Send(reversePath string, recipients []string, msg []byte) error
Send sends a message using either implicit TLS or STARTTLS as configured.
func (*CustomSMTPSender) TestConnection ¶
func (s *CustomSMTPSender) TestConnection() error
TestConnection verifies connectivity and authentication without sending an email.
type DialMode ¶
type DialMode string
DialMode represents an authentication type
func (DialMode) ToStringTrimLower ¶
ToStringTrimLower returns the trimmed and lowercased string representation of the DialMode
type DialModes ¶
type DialModes []DialMode
DialModes represents a slice of DialMode
func (DialModes) Matches ¶
Matches checks if any DialMode in the DialModes slice matches the given string
func (DialModes) ToStringArray ¶
ToStringArray returns an array of DialModes as strings
type EmailPropertyData ¶
type EmailPropertyData struct { // Section 1: Used Username string `json:"username"` // Recipient's username AppName string `json:"appName"` // Application name PublicUrl string `json:"publicUrl"` // The public url ClickLink string `json:"clickLink"` // URL or token link for actions ExpirationTime time.Time `json:"expirationTime"` // Link expiration duration OrgName string `json:"orgName"` // Organization name OrgContactName string `json:"orgContactName"` // Support contact's name }
EmailPropertyData defines common placeholders used in email templates.
func NewEmailPropertyData ¶
func (*EmailPropertyData) MergeTo ¶
func (e *EmailPropertyData) MergeTo(data *EmailPropertyData)
MergeTo merges the receiver's data into `data` where `data`'s fields are empty or zero.
type IMailManager ¶
type IMailManager interface { FindTemplate(templateName MailTemplateName) *MailTemplate SendWithRender(templateName MailTemplateName, addressGroup *MailAddressGroup, subjectMerge []interface{}, dataBody interface{}) error SendWithRenderOptions(templateName MailTemplateName, smtpAuth ISMTPAuth, addressGroup *MailAddressGroup, subjectMerge []interface{}, dataBody interface{}) error }
func MAILMANAGER ¶
func MAILMANAGER() IMailManager
type ISBAdapterSMTP ¶
type ISBAdapterSMTP interface { aconns.ISBAdapter }
ISBAdapterSMTP is for sandboxed adapters with SMTP capability.
type ISMTPAuth ¶
type ISMTPAuth interface { GetSender() (enmime.Sender, error) GetName() aconns.AdapterName }
ISMTPAuth defines an interface for SMTP authentication
type MailAddressGroup ¶
type MailAddressGroup struct { From mail.Address `json:"from,omitempty"` To []mail.Address `json:"to,omitempty"` CC []mail.Address `json:"cc,omitempty"` BCC []mail.Address `json:"bcc,omitempty"` }
MailAddressGroup represents a group of email addresses, including From, To, CC, and BCC fields.
func NewMAG ¶
func NewMAG(from mail.Address, to []mail.Address, cc []mail.Address, bcc []mail.Address) *MailAddressGroup
NewMAG creates a new MailAddressGroup with all fields provided.
func NewMAGWithBCC ¶
func NewMAGWithBCC(from mail.Address, bcc []mail.Address) *MailAddressGroup
NewMAGWithBCC creates a new MailAddressGroup with "From" and "BCC" addresses.
func NewMAGWithBCCString ¶
func NewMAGWithBCCString(from string, bcc []string) *MailAddressGroup
NewMAGWithBCCString creates a MailAddressGroup with "From" and "BCC" email address strings.
func NewMAGWithCC ¶
func NewMAGWithCC(from mail.Address, cc []mail.Address) *MailAddressGroup
NewMAGWithCC creates a new MailAddressGroup with "From" and "CC" addresses.
func NewMAGWithCCString ¶
func NewMAGWithCCString(from string, cc []string) *MailAddressGroup
NewMAGWithCCString creates a MailAddressGroup with "From" and "CC" email address strings.
func NewMAGWithSingleToAndCCBCC ¶
func NewMAGWithSingleToAndCCBCC(from mail.Address, to mail.Address, cc []mail.Address, bcc []mail.Address) *MailAddressGroup
NewMAGWithSingleToAndCCBCC creates a new MailAddressGroup with a single "To", "CC", and "BCC" addresses.
func NewMAGWithTo ¶
func NewMAGWithTo(from mail.Address, to mail.Address) *MailAddressGroup
NewMAGWithTo creates a new MailAddressGroup with a single "To" address.
func NewMAGWithToAndBCC ¶
NewMAGWithToAndBCC creates a new MailAddressGroup with a single "To" address and "BCC" addresses.
func NewMAGWithToAndCC ¶
NewMAGWithToAndCC creates a new MailAddressGroup with a single "To" address and "CC" addresses.
func NewMAGWithToCCBCCString ¶
func NewMAGWithToCCBCCString(from string, to string, cc []string, bcc []string) *MailAddressGroup
NewMAGWithToCCBCCString creates a MailAddressGroup with "To", "CC", and "BCC" email address strings.
func NewMAGWithToString ¶
func NewMAGWithToString(from string, to string) *MailAddressGroup
NewMAGWithToString creates a MailAddressGroup with a single "To" email address string.
func (*MailAddressGroup) MergeInto ¶
func (mag *MailAddressGroup) MergeInto(mergeTo *MailAddressGroup)
MergeInto merges the non-empty properties of the source (mag) into the target (mergeTo) only if the target properties are empty.
func (*MailAddressGroup) MergeIntoTemplate ¶
func (mag *MailAddressGroup) MergeIntoTemplate(template *MailPiece)
MergeIntoTemplate merges non-empty values from a MailAddressGroup into a MailPiece. This ensures that only fields with data in the MailAddressGroup overwrite corresponding fields in MailPiece.
type MailManager ¶
type MailManager struct { SMTPs AClientSMTPs `json:"smtps,omitempty"` Templates MailTemplates `json:"templates,omitempty"` MAGDefaults MailAddressGroup `json:"magDefaults,omitempty"` // contains filtered or unexported fields }
MailManager is responsible for managing SMTP connections and mail sender groups.
func (*MailManager) FindTemplate ¶
func (mm *MailManager) FindTemplate(templateName MailTemplateName) *MailTemplate
func (*MailManager) SendWithRender ¶
func (mm *MailManager) SendWithRender(templateName MailTemplateName, mergeAddressGroup *MailAddressGroup, subjectMerge []interface{}, dataBody interface{}) error
func (*MailManager) SendWithRenderOptions ¶
func (mm *MailManager) SendWithRenderOptions(templateName MailTemplateName, smtpAuth ISMTPAuth, mergeAddressGroup *MailAddressGroup, subjectMerge []interface{}, dataBody interface{}) error
func (*MailManager) Validate ¶
func (mm *MailManager) Validate() error
Validate checks the integrity of the MailManager instance. It ensures that the MailManager itself, SMTP connections, and mail sender groups are valid. It associates the smtp connection with the template. Returns an error if any validation step fails.
type MailPiece ¶
type MailPiece struct { From mail.Address `json:"from,omitempty"` To []mail.Address `json:"to,omitempty"` CC []mail.Address `json:"cc,omitempty"` BCC []mail.Address `json:"bcc,omitempty"` AllowEmptySubject bool `json:"allowEmptySubject,omitempty"` Subject string `json:"subject,omitempty"` AllowNoTextHMTL bool `json:"allowNoTextHMTL,omitempty"` Text string `json:"text,omitempty"` HTML string `json:"html,omitempty"` AllowAttachments bool `json:"allowAttachments,omitempty"` // Uses Attachments instead of []*enmime.Part, to allow more // flexibility, efficiency and long-term storage options at the app level. Attachments Attachments `json:"attachments,omitempty"` Inlines Attachments `json:"inlines,omitempty"` }
MailPiece represents an email with various fields
func (*MailPiece) Clone ¶
Clone creates a deep copy of the MailPiece object, including all nested fields.
type MailTemplate ¶
type MailTemplate struct { Name MailTemplateName `json:"name,omitempty"` // The name of the mail template. SmtpOverride aconns.AdapterName `json:"smtpOverride,omitempty"` // Optional override of the SMTP adapter MailPiece SubjectMerge string `json:"subjectMerge,omitempty"` // Format string for subject merging. SnippetTextName string `json:"snippetTextName,omitempty"` // Name of the text snippet. SnippetHTMLName string `json:"snippetHTMLName,omitempty"` // Name of the HTML snippet. // contains filtered or unexported fields }
MailTemplate represents an individual email template.
func (*MailTemplate) PreValidate ¶
func (mt *MailTemplate) PreValidate() error
PreValidate checks the validity of the MailTemplate. It trims unnecessary spaces and ensures required snippets are loaded. Returns an error if validation fails.
func (*MailTemplate) SendWithRender ¶
func (mt *MailTemplate) SendWithRender(addressGroup *MailAddressGroup, subjectMerge []interface{}, dataBody interface{}) error
SendWithRender prepares and sends an email using the MailTemplate.
func (*MailTemplate) SendWithRenderOptions ¶
func (mt *MailTemplate) SendWithRenderOptions(smtpAuth ISMTPAuth, addressGroup *MailAddressGroup, subjectMerge []interface{}, dataBody interface{}) error
SendWithRenderOptions prepares and sends an email using the MailTemplate. It renders the subject and body with provided data and sends the email via SMTP authentication.
type MailTemplateMap ¶
type MailTemplateMap map[MailTemplateName]*MailTemplate
type MailTemplateName ¶
type MailTemplateName string
MailTemplateName represents a mail template name
func (MailTemplateName) IsEmpty ¶
func (mtn MailTemplateName) IsEmpty() bool
IsEmpty checks if the MailTemplateName is empty
func (MailTemplateName) Matches ¶
func (mtn MailTemplateName) Matches(s string) bool
Matches checks if the MailTemplateName matches the given string
func (MailTemplateName) String ¶
func (mtn MailTemplateName) String() string
String returns the string representation of the MailTemplateName
func (MailTemplateName) TrimSpace ¶
func (mtn MailTemplateName) TrimSpace() MailTemplateName
TrimSpace returns the trimmed string representation of the MailTemplateName
type MailTemplateNames ¶
type MailTemplateNames []MailTemplateName
MailTemplateNames represents a slice of MailTemplateName
func (MailTemplateNames) Find ¶
func (mtns MailTemplateNames) Find(mtn MailTemplateName) MailTemplateName
Find returns the MailTemplateName if found, otherwise an empty MailTemplateName
func (MailTemplateNames) HasKey ¶
func (mtns MailTemplateNames) HasKey(s MailTemplateName) bool
HasKey checks if the MailTemplateNames slice contains the given MailTemplateName
func (MailTemplateNames) IsEmpty ¶
func (mtns MailTemplateNames) IsEmpty() bool
IsEmpty checks if the MailTemplateNames slice is empty
func (MailTemplateNames) Matches ¶
func (mtns MailTemplateNames) Matches(s string) bool
Matches checks if any MailTemplateName in the MailTemplateNames slice matches the given string
func (MailTemplateNames) String ¶
func (mtns MailTemplateNames) String() string
String returns the string representation of the MailTemplateNames slice
func (MailTemplateNames) ToStringArray ¶
func (mtns MailTemplateNames) ToStringArray() []string
ToStringArray returns an array of MailTemplateNames as strings
type MailTemplates ¶
type MailTemplates []*MailTemplate
MailTemplates represents a collection of MailTemplate pointers.
func (MailTemplates) FindByName ¶
func (mts MailTemplates) FindByName(name MailTemplateName) *MailTemplate
FindByName searches for a MailTemplate by its name. Returns a pointer to the template if found, or nil otherwise.
func (MailTemplates) ToMap ¶
func (mts MailTemplates) ToMap() MailTemplateMap
ToMap converts the array to a map of MailTemplates using MailTemplateName as the key.