Documentation ¶
Overview ¶
Package sendgrid provides a simple interface to interact with the SendGrid API
Index ¶
- Constants
- type SGClient
- type SGMail
- func (m *SGMail) AddAttachment(filename string, file io.Reader) error
- func (m *SGMail) AddAttachmentFromStream(filename, file string)
- func (m *SGMail) AddBcc(bcc string) error
- func (m *SGMail) AddBccRecipient(recipient *mail.Address)
- func (m *SGMail) AddBccRecipients(recipients []*mail.Address)
- func (m *SGMail) AddBccs(bccs []string) error
- func (m *SGMail) AddCc(cc string) error
- func (m *SGMail) AddCcRecipient(recipient *mail.Address)
- func (m *SGMail) AddCcRecipients(recipients []*mail.Address)
- func (m *SGMail) AddCcs(ccs []string) error
- func (m *SGMail) AddContentID(id, value string)
- func (m *SGMail) AddHeader(header, value string)
- func (m *SGMail) AddRecipient(recipient *mail.Address)
- func (m *SGMail) AddRecipients(recipients []*mail.Address)
- func (m *SGMail) AddTo(email string) error
- func (m *SGMail) AddToName(name string)
- func (m *SGMail) AddToNames(names []string)
- func (m *SGMail) AddTos(emails []string) error
- func (m *SGMail) HeadersString() (string, error)
- func (m *SGMail) SetDate(date string)
- func (m *SGMail) SetFrom(from string) error
- func (m *SGMail) SetFromEmail(address *mail.Address)
- func (m *SGMail) SetFromName(fromname string)
- func (m *SGMail) SetHTML(html string)
- func (m *SGMail) SetRFCDate(date time.Time)
- func (m *SGMail) SetReplyTo(replyto string) error
- func (m *SGMail) SetReplyToEmail(address *mail.Address)
- func (m *SGMail) SetSubject(subject string)
- func (m *SGMail) SetText(text string)
Constants ¶
const Version = "2.0.0"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SGClient ¶
type SGClient struct { APIMail string Client *http.Client // contains filtered or unexported fields }
SGClient will contain the credentials and default values
func NewSendGridClient ¶
NewSendGridClient will return a new SGClient. Used for username and password
func NewSendGridClientWithApiKey ¶
NewSendGridClient will return a new SGClient. Used for api key
type SGMail ¶
type SGMail struct { To []string ToName []string Cc []string Subject string Text string HTML string From string Bcc []string FromName string ReplyTo string Date string Files map[string]string Content map[string]string Headers map[string]string smtpapi.SMTPAPIHeader }
SGMail is representation of a valid SendGrid Mail
func (*SGMail) AddAttachment ¶
AddAttachment allows file attachments to be sent. For security reasons, this method doesn't take filepaths only the io.Reader interface.
func (*SGMail) AddAttachmentFromStream ¶
AddAttachmentFromStream ...
func (*SGMail) AddBccRecipient ¶
AddBccRecipient ...
func (*SGMail) AddBccRecipients ¶
AddBccRecipients ...
func (*SGMail) AddCcRecipient ¶
AddCcRecipient ...
func (*SGMail) AddCcRecipients ¶
AddCcRecipients ...
func (*SGMail) AddRecipient ¶
AddRecipient will add mail.Address emails to recipients.
func (*SGMail) AddRecipients ¶
AddRecipients calls AddRecipient per email
func (*SGMail) AddToNames ¶
AddToNames sets the "pretty" name for multiple recipients
func (*SGMail) HeadersString ¶
func (*SGMail) SetFromEmail ¶
SetFromEmail sets the senders email property
func (*SGMail) SetReplyToEmail ¶
SetReplyToEmail ...
func (*SGMail) SetSubject ¶
SetSubject sets the email's subject