Documentation ¶
Index ¶
- type Client
- func (c *Client) AttachFile(filename string)
- func (c *Client) BCC(toName, toEmail string)
- func (c *Client) BodyHTML(bodyHTML string)
- func (c *Client) BodyText(bodyText string)
- func (c *Client) CC(toName, toEmail string)
- func (c *Client) Debug() string
- func (c *Client) From(fromName, fromEmail string)
- func (c *Client) NewMessage()
- func (c *Client) Send() error
- func (c *Client) Sendmail(toName, toEmail, subject, message string) error
- func (c *Client) Subject(subject string)
- func (c *Client) To(toName, toEmail string)
- type ClientConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a struct for holding the configuration of the email client and a pointer to the email object from the library.
func NewClient ¶
func NewClient(opts ...ClientConfig) *Client
NewClient returns a Client object. The object was optionally configured with a variadic list of ClientConfig functions.
func (*Client) AttachFile ¶
AttachFile attaches a file to the email Client.
func (*Client) NewMessage ¶
func (c *Client) NewMessage()
func (*Client) Sendmail ¶
Sendmail sends an email with a given subject and body text to the provided email address. This is a shortcut to To, Subject, ....
type ClientConfig ¶
type ClientConfig func(*Client)
ClientConfig is a type for the variadic functions to configure the Client object.
func WithAuth ¶
func WithAuth(username, password string, useAuth bool) ClientConfig
WithAuth configures the Client with a username and password for authentication with the SMTP server; sets the corresponding flag useAuth as well.
func WithDontSend ¶
func WithDontSend() ClientConfig
WithDontSend configures the Client with the dontSend flag, i.e. there is no email sent.
func WithRelayhost ¶
func WithRelayhost(host string, port int) ClientConfig
WithRelayhost configures the Client with a host name and a port to send the email to.
func WithSender ¶
func WithSender(name, email string) ClientConfig
WithSender configures the Client with a sender name and email address.