Versions in this module Expand all Collapse all v1 v1.0.0 Mar 29, 2026 Changes in this version + const DefaultSendBurst + const DefaultSendRate + const MaxMessageSize + var ErrClientNil = errors.New("gmail client is nil") + var ErrMissingBody = errors.New("message must have a text or HTML body") + var ErrMissingRecipient = errors.New("message must have at least one recipient (To, Cc, or Bcc)") + var ErrQuotaReached = errors.New("gmail API daily quota reached") + type Attachment struct + ContentID string + Data []byte + Filename string + IsInline bool + type Client struct + func NewClient(ctx context.Context, credentialsJSON []byte, opts ...ClientOption) (*Client, error) + func (c *Client) NewMessage() *Message + type ClientOption func(*Client) + func WithAutoRetry() ClientOption + func WithRateLimiter(rl *RateLimiter) ClientOption + type ErrRateLimitExceeded struct + Message string + RetryAfter time.Time + func (e *ErrRateLimitExceeded) Error() string + type Message struct + func (m *Message) Attach(filename string, r io.Reader) *Message + func (m *Message) AttachFile(path string) *Message + func (m *Message) BCC(addresses ...string) *Message + func (m *Message) CC(addresses ...string) *Message + func (m *Message) EmbedFile(path string, cid string) *Message + func (m *Message) HTMLBody(body string) *Message + func (m *Message) Send(ctx context.Context) error + func (m *Message) Subject(sub string) *Message + func (m *Message) TextBody(body string) *Message + func (m *Message) To(addresses ...string) *Message + type RateLimiter struct + func DefaultRateLimiter() *RateLimiter + func NewRateLimiter(r rate.Limit, b int) *RateLimiter + func (rl *RateLimiter) RequestToken(ctx context.Context) error + type Sender interface + NewMessage func() *Message