Documentation
¶
Index ¶
Constants ¶
const ( ContentHTML = "html" ContentText = "text" )
ContentHTML represents the content type for HTML emails.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(c ConnectionDetails) (*email, error)
New creates a new email instance using the provided connection details. It validates the connection details and initializes a dialer for sending emails.
Parameters:
- c: ConnectionDetails containing SMTP host, port, user, and password.
Returns:
- *email: A pointer to the initialized email instance.
- error: An error if the connection details validation fails or any other issue occurs.
Types ¶
type ConnectionDetails ¶
ConnectionDetails holds the configuration details required to establish a connection to an SMTP server for sending emails. It includes the server host, port, and authentication credentials.
type Content ¶
Content represents the structure for email content. It includes the type of content, the actual content, an optional template path for rendering, and any associated data.
Fields: - Type: Specifies the type of the content (e.g., "text/plain", "text/html"). - Content: The actual content of the email as a string. - TemplatePath: Path to the template file used for rendering the content (optional). - Data: Data to be used for populating the template (if applicable).
type MailDetails ¶
type MailDetails struct {
To []string
Cc []string
Bcc []string
Subject string
Sender string
SenderName string
ReturnEmail string
Tags string
Content Content
ImagesToEmbed []string
}
MailDetails represents the details of an email to be sent. It includes information about the recipients, sender, subject, and content.
Fields: - To: A list of recipient email addresses. - Cc: A list of email addresses to be included in the CC (carbon copy) field. - Bcc: A list of email addresses to be included in the BCC (blind carbon copy) field. - Subject: The subject line of the email. - Sender: The email address of the sender. - SenderName: The name of the sender to be displayed in the email. - ReturnEmail: The email address to which replies should be sent. - Tags: Tags associated with the email for categorization or tracking purposes. - Content: The main content of the email, represented by a Content struct. - ImagesToEmbed: A list of file paths for images to be embedded in the email.