Documentation
¶
Index ¶
- func Body(m *gmail.Message) string
- func CreatedAt(m *gmail.Message) time.Time
- func HasLabel(m *gmail.Message, id string) bool
- func Header(m *gmail.Message, header string) string
- func HostMessageID(m *gmail.Message) string
- func IsSent(m *gmail.Message) bool
- func Recipient(m *gmail.Message) string
- func RecipientEmail(m *gmail.Message) string
- func Sender(m *gmail.Message) string
- func SenderEmail(m *gmail.Message) string
- func SortByDate(messages []*gmail.Message)
- func Subject(m *gmail.Message) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Body ¶
func Body(m *gmail.Message) string
Body returns the body of the message as a string
It first checks for a text/plain body. If none is found, it checks for a text/html body.
func CreatedAt ¶
CreatedAt returns the time the message was created in the email provider.
For senders, this is the time the message was sent. For recipients, this is the time the message was received.
func HostMessageID ¶
func HostMessageID(m *gmail.Message) string
HostMessageID returns the message id of the message as it was received by the email provider.
This a convenience function that calls Header(m, "Message-ID")
func IsSent ¶
func IsSent(m *gmail.Message) bool
IsSent returns true if the message was sent by the current user
There are a number of ways to check if a message was sent by a user. This function checks if the message contains the system "SENT" label, which allows us to only fetch the minimal message information (no headers) from a thread.
func Recipient ¶
func Recipient(m *gmail.Message) string
Recipient returns the sender of the message The sender is the email address of the first "To" header
This doesn't support multiple recipients.
func RecipientEmail ¶
func RecipientEmail(m *gmail.Message) string
RecipientEmail returns the email address of the recipient It uses Recipient to get the recipient string, and then extracts the email address from it.
Example: "John Doe" <john.doe@example.com>" -> "john.doe@example.com"
func Sender ¶
func Sender(m *gmail.Message) string
Sender returns the sender of the message The sender is the email address of the first "From" header
func SenderEmail ¶
func SenderEmail(m *gmail.Message) string
SenderEmail returns the email address of the sender It uses Sender to get the sender string, and then extracts the email address from it.
Example: "John Doe" <john.doe@example.com>" -> "john.doe@example.com"
func SortByDate ¶
func SortByDate(messages []*gmail.Message)
SortByDate sorts messages by date received by gmail (ascending) The messages are sorted in place.
Types ¶
This section is empty.