Versions in this module Expand all Collapse all v0 v0.5.0 Nov 9, 2022 Changes in this version + const LabelTypeMailBox + const LabelTypeV4ContactGroup + const LabelTypeV4Folder + const LabelTypeV4Label type Client + CreateLabelV4 func(ctx context.Context, label *Label) (*Label, error) + DeleteLabelV4 func(ctx context.Context, labelID string) error + ListFoldersOnly func(ctx context.Context) ([]*Label, error) + ListLabelsOnly func(ctx context.Context) ([]*Label, error) + UpdateLabelV4 func(ctx context.Context, label *Label) (*Label, error) + type LabelTypeV4 int v0.4.0 May 27, 2022 v0.3.0 May 16, 2022 v0.2.0 May 9, 2022 Changes in this version + const ActionForward + const ActionReply + const ActionReplyAll + const ActiveUser + const AdminUser + const AliasAddress + const AllDraftsLabel + const AllMailLabel + const AllSentLabel + const ArchiveLabel + const AvailableUser + const CardEncrypted + const CardSigned + const ClearMIMEPackage + const ClearPackage + const ContentTypeHTML + const ContentTypeMultipartEncrypted + const ContentTypeMultipartMixed + const ContentTypePlainText + const ConversationIDDomain + const CurrentUser + const CustomAddress + const DeletedUser + const DelinquentUser + const DisabledAddress + const DisabledUser + const DispositionAttachment + const DispositionInline + const DraftActionForward + const DraftActionReply + const DraftActionReplyAll + const DraftLabel + const EnabledAddress + const EncryptedOutsidePackage + const EventRefreshAll + const EventRefreshContact + const EventRefreshMail + const FlagAuto + const FlagAutoreplied + const FlagDkimFail + const FlagDmarcFail + const FlagE2E + const FlagForwarded + const FlagHamManual + const FlagImported + const FlagInternal + const FlagMask + const FlagMaskAdd + const FlagMaskDraft + const FlagMaskGeneral + const FlagMaskSpam + const FlagOpened + const FlagPhishingAuto + const FlagPhishingManual + const FlagPublicKey + const FlagReceiptRequest + const FlagReceiptSent + const FlagReceived + const FlagReplied + const FlagRepliedAll + const FlagSent + const FlagSign + const FlagSpamAuto + const FlagSpamManual + const FlagSpfFail + const FreeUserRole + const GoogleProvider + const InboxLabel + const InternalIDDomain + const InternalPackage + const KeysPresent + const LabelTypeContactGroup + const LabelTypeMailbox + const MainSendAddress + const MaxImportMessageRequestLength + const MaxImportMessageRequestSize + const MessageHeader + const MessageHeaderLegacy + const MessageTail + const MessageTailLegacy + const MissingKeys + const NoReceiveUser + const NoSendAddress + const OriginalAddress + const OverdueUser + const PGPInlinePackage + const PGPMIMEPackage + const PMSignatureDisabled + const PMSignatureEnabled + const PMSignatureLocked + const PaidAdminRole + const PaidMemberRole + const PremiumAddress + const Quad9PortProvider + const Quad9Provider + const RandomKeyHeader + const RandomKeyTail + const SecondarySendAddress + const SentLabel + const SignatureAttachedArmored + const SignatureDetached + const SignatureNone + const SortAsc + const SortByFrom + const SortByID + const SortBySize + const SortBySubject + const SortByTime + const SortByTo + const SortDesc + const SpamLabel + const StarredLabel + const SuperUser + const TLSReportURI + const TrashLabel + const UseToEncryptFlag + const UseToVerifyFlag + const VPNAdminUser + var ErrBad2FACode = errors.New("incorrect 2FA code") + var ErrBad2FACodeTryAgain = errors.New("incorrect 2FA code: please try again") + var ErrNoConnection = errors.New("no internet connection") + var ErrNoKeyringAvailable = errors.New("no keyring available") + var ErrPaidPlanRequired = errors.New("paid subscription plan is required") + var ErrPasswordWrong = errors.New("wrong password") + var ErrTLSMismatch = errors.New("no TLS fingerprint match found") + var ErrUnauthorized = errors.New("API client is unauthorized") + var ErrUpgradeApplication = errors.New("application upgrade required") + var LabelColors = []string + var RxInternalReferenceFormat = regexp.MustCompile(`(?U)<(.+)@` + regexp.QuoteMeta(InternalIDDomain) + `>`) + var TrustedAPIPins = []string + func ComputeMessageFlagsByLabels(labels []string) (flag int64) + func ConstructAddress(headerEmail string, addressEmail string) string + func ContextWithoutAuthRefresh(parent context.Context) context.Context + func ContextWithoutRetry(parent context.Context) context.Context + func CreateTransportWithDialer(dialer TLSDialer) *http.Transport + func HashMailboxPassword(password []byte, salt string) ([]byte, error) + func IsBadRequest(err error) bool + func IsFailedAuth(err error) bool + func IsFailedUnlock(err error) bool + func IsSystemLabel(label string) bool + func IsUnprocessableEntity(err error) bool + func LeastUsedColor(colors []string) (color string) + func SanitizeEmail(email string) string + type Address struct + DisplayName string + DomainID string + Email string + HasKeys int + ID string + Keys PMKeys + MemberID string + MemberName string + Order int + Receive Boolean + Send int + Signature string + Status int + Type int + type AddressList []*Address + func (l AddressList) ActiveEmails() (addresses []string) + func (l AddressList) AllEmails() (addresses []string) + func (l AddressList) ByEmail(email string) *Address + func (l AddressList) ByID(id string) *Address + func (l AddressList) Main() *Address + type AlgoKey struct + Algorithm string + Key string + type Attachment struct + ContentID string + Disposition string + Header textproto.MIMEHeader + ID string + KeyPackets string + MIMEType string + MessageID string + Name string + Signature string + Size int64 + func (a *Attachment) Decrypt(r io.Reader, kr *crypto.KeyRing) (decrypted io.Reader, err error) + func (a *Attachment) DetachedSign(kr *crypto.KeyRing, att io.Reader) (signed io.Reader, err error) + func (a *Attachment) Encrypt(kr *crypto.KeyRing, att io.Reader) (encrypted io.Reader, err error) + func (a *Attachment) MarshalJSON() ([]byte, error) + func (a *Attachment) UnmarshalJSON(b []byte) error + type Auth struct + PasswordMode PasswordMode + ServerProof string + TwoFA *TwoFAInfo + UserID string + func (a Auth) HasMailboxPassword() bool + func (a Auth) HasTwoFactor() bool + type AuthInfo struct + Modulus string + SRPSession string + Salt string + ServerEphemeral string + Version int + type AuthModulus struct + Modulus string + ModulusID string + type AuthRefresh struct + AccessToken string + ExpiresIn int64 + RefreshToken string + Scopes []string + UID string + type AuthRefreshHandler func(*AuthRefresh) + type AuthReq struct + ClientEphemeral string + ClientProof string + SRPSession string + Username string + type BasicTLSDialer struct + func NewBasicTLSDialer(cfg Config) *BasicTLSDialer + func (d *BasicTLSDialer) DialTLS(network, address string) (conn net.Conn, err error) + type Boolean bool + func (boolean *Boolean) UnmarshalJSON(b []byte) error + func (boolean Boolean) MarshalJSON() ([]byte, error) + type Card struct + Data string + Signature string + Type int + type Client interface + AddAuthRefreshHandler func(AuthRefreshHandler) + Addresses func() AddressList + Auth2FA func(context.Context, string) error + AuthDelete func(context.Context) error + AuthSalt func(ctx context.Context) (string, error) + CountMessages func(ctx context.Context, addressID string) ([]*MessagesCount, error) + CreateAttachment func(ctx context.Context, att *Attachment, r io.Reader, sig io.Reader) (created *Attachment, err error) + CreateDraft func(ctx context.Context, m *Message, parent string, action int) (created *Message, err error) + CreateLabel func(ctx context.Context, label *Label) (*Label, error) + CurrentUser func(ctx context.Context) (*User, error) + DecryptAndVerifyCards func([]Card) ([]Card, error) + DeleteLabel func(ctx context.Context, labelID string) error + DeleteMessages func(ctx context.Context, apiIDs []string) error + EmptyFolder func(ctx context.Context, labelID string, addressID string) error + GetAddresses func(context.Context) (addresses AddressList, err error) + GetAttachment func(ctx context.Context, id string) (att io.ReadCloser, err error) + GetContactByID func(context.Context, string) (Contact, error) + GetContactEmailByEmail func(context.Context, string, int, int) ([]ContactEmail, error) + GetEvent func(ctx context.Context, eventID string) (*Event, error) + GetMailSettings func(ctx context.Context) (MailSettings, error) + GetMessage func(ctx context.Context, apiID string) (*Message, error) + GetPublicKeysForEmail func(context.Context, string) ([]PublicKey, bool, error) + GetUser func(ctx context.Context) (*User, error) + GetUserKeyRing func() (*crypto.KeyRing, error) + Import func(context.Context, ImportMsgReqs) ([]*ImportMsgRes, error) + IsUnlocked func() bool + KeyRingForAddressID func(string) (kr *crypto.KeyRing, err error) + LabelMessages func(ctx context.Context, apiIDs []string, labelID string) error + ListLabels func(ctx context.Context) ([]*Label, error) + ListMessages func(ctx context.Context, filter *MessagesFilter) ([]*Message, int, error) + MarkMessagesRead func(ctx context.Context, apiIDs []string) error + MarkMessagesUnread func(ctx context.Context, apiIDs []string) error + ReloadKeys func(ctx context.Context, passphrase []byte) (err error) + ReorderAddresses func(ctx context.Context, addressIDs []string) error + SendMessage func(context.Context, string, *SendMessageReq) (sent, parent *Message, err error) + UnlabelMessages func(ctx context.Context, apiIDs []string, labelID string) error + Unlock func(ctx context.Context, passphrase []byte) (err error) + UpdateLabel func(ctx context.Context, label *Label) (*Label, error) + UpdateUser func(ctx context.Context) (*User, error) + type Config struct + AppVersion string + HostURL string + TLSIssueHandler func() + UpgradeApplicationHandler func() + func NewConfig() Config + type ConnectionObserver interface + OnDown func() + OnUp func() + func NewConnectionObserver(onDown, onUp func()) ConnectionObserver + type Contact struct + Cards []Card + ContactEmails []ContactEmail + CreateTime int64 + ID string + LabelIDs []string + ModifyTime int64 + Name string + Size int64 + UID string + type ContactEmail struct + ContactID string + Defaults int + Email string + ID string + LabelIDs []string + Name string + Order int + Type []string + type DraftReq struct + Action int + AttachmentKeyPackets []string + Message *Message + ParentID string + type ErrAuthFailed struct + OriginalError error + func (err ErrAuthFailed) Error() string + type ErrBadRequest struct + OriginalError error + func (err ErrBadRequest) Error() string + type ErrUnlockFailed struct + OriginalError error + func (err ErrUnlockFailed) Error() string + type ErrUnprocessableEntity struct + OriginalError error + func (err ErrUnprocessableEntity) Error() string + type Error struct + Code int + Message string + func (err Error) Error() string + type Event struct + Addresses []*EventAddress + EventID string + Labels []*EventLabel + MessageCounts []*MessagesCount + Messages []*EventMessage + More Boolean + Notices []string + Refresh int + UsedSpace *int64 + User *User + type EventAction int + const EventCreate + const EventDelete + const EventUpdate + const EventUpdateFlags + type EventAddress struct + Address *Address + type EventItem struct + Action EventAction + ID string + type EventLabel struct + Label *Label + type EventMessage struct + Created *Message + Updated *EventMessageUpdated + func (em *EventMessage) MarshalJSON() ([]byte, error) + func (em *EventMessage) UnmarshalJSON(b []byte) (err error) + type EventMessageUpdated struct + BCCList *[]*mail.Address + CCList *[]*mail.Address + Flags *int64 + ID string + LabelIDs []string + LabelIDsAdded []string + LabelIDsRemoved []string + Sender *mail.Address + Subject *string + Time int64 + ToList *[]*mail.Address + Unread *Boolean + type GetAuthInfoReq struct + Username string + type ImportMetadata struct + AddressID string + Flags int64 + IsForwarded Boolean + IsReplied Boolean + IsRepliedAll Boolean + LabelIDs []string + Time int64 + Unread Boolean + type ImportMsgReq struct + Message []byte + Metadata *ImportMetadata + type ImportMsgReqs []*ImportMsgReq + type ImportMsgRes struct + Error error + MessageID string + type KeySalt struct + ID string + KeySalt string + type Label struct + Color string + Display int + Exclusive Boolean + ID string + Name string + Notify Boolean + Order int + Path string + Type int + type LabelMessagesReq struct + IDs []string + LabelID string + type LabelReq struct + type LabelsOperation int + const AddLabels + const KeepLabels + const RemoveLabels + const ReplaceLabels + type MailSettings struct + AlsoArchive int + AttachPublicKey int + AutoSaveContacts int + AutoWildcardSearch int + Autocrypt int + ComposerMode int + DisplayName string + DraftMIMEType string + Hotkeys int + ImageProxy int + MessageButtons int + NumMessagePerPage int + PGPScheme PackageFlag + PMSignature int + PromptPin int + ReceiveMIMEType string + RightToLeft int + ShowImages int + ShowMIMEType string + ShowMoved int + Sign int + Signature string + SwipeLeft int + SwipeRight int + TLS int + Theme string + ViewLayout int + ViewMode int + type Manager interface + AddConnectionObserver func(ConnectionObserver) + AllowProxy func() + DisallowProxy func() + NewClient func(string, string, string, time.Time) Client + NewClientWithLogin func(context.Context, string, []byte) (Client, *Auth, error) + NewClientWithRefresh func(context.Context, string, string) (Client, *AuthRefresh, error) + SetCookieJar func(http.CookieJar) + SetLogging func(logger *logrus.Entry, verbose bool) + SetRetryCount func(int) + SetTransport func(http.RoundTripper) + func New(cfg Config) Manager + type Message struct + AddressID string + Attachments []*Attachment + BCCList []*mail.Address + Body string + CCList []*mail.Address + ConversationID string + ExpirationTime int64 + ExternalID string + Flags int64 + Header mail.Header + ID string + LabelIDs []string + MIMEType string + NumAttachments int + Order int64 + ReplyTo *mail.Address + ReplyTos []*mail.Address + Sender *mail.Address + SpamScore int + Subject string + Time int64 + ToList []*mail.Address + Unread Boolean + func NewMessage() *Message + func (m *Message) Decrypt(kr *crypto.KeyRing) ([]byte, error) + func (m *Message) Encrypt(encrypter, signer *crypto.KeyRing) (err error) + func (m *Message) ExtractSignatures(kr *crypto.KeyRing) ([]Signature, error) + func (m *Message) Has(flag int64) bool + func (m *Message) HasLabelID(labelID string) bool + func (m *Message) IsBodyEncrypted() bool + func (m *Message) IsDraft() bool + func (m *Message) IsEncrypted() bool + func (m *Message) IsLegacyMessage() bool + func (m *Message) MarshalJSON() ([]byte, error) + func (m *Message) Recipients() []*mail.Address + func (m *Message) UnmarshalJSON(b []byte) error + type MessageAddress struct + EncryptedAttachmentKeyPackets map[string]string + EncryptedBodyKeyPacket string + Signature SignatureFlag + Type PackageFlag + type MessagePackage struct + Addresses map[string]*MessageAddress + DecryptedAttachmentKeys map[string]AlgoKey + DecryptedBodyKey *AlgoKey + EncryptedBody string + MIMEType string + Type PackageFlag + type MessagesActionReq struct + IDs []string + type MessagesCount struct + LabelID string + Total int + Unread int + type MessagesFilter struct + AddressID string + Attachments *bool + AutoWildcard *bool + Begin int64 + BeginID string + ConversationID string + Desc *bool + End int64 + EndID string + ExternalID string + From string + ID []string + Keyword string + LabelID string + Limit int + Page int + PageSize int + Sort string + Subject string + To string + Unread *bool + type PMKey struct + Active Boolean + Fingerprint string + Flags int + ID string + Primary int + PrivateKey *crypto.Key + Signature string + Token string + Version int + func (key *PMKey) UnmarshalJSON(b []byte) (err error) + type PMKeys []PMKey + func (keys *PMKeys) UnlockAll(passphrase []byte, userKey *crypto.KeyRing) (kr *crypto.KeyRing, err error) + type PackageFlag int + func (p *PackageFlag) Has(flag PackageFlag) bool + func (p *PackageFlag) HasAtLeastOne(flag PackageFlag) bool + func (p *PackageFlag) HasNo(flag PackageFlag) bool + func (p *PackageFlag) Is(flag PackageFlag) bool + type PasswordMode int + const OnePasswordMode + const TwoPasswordMode + type PinningTLSDialer struct + func NewPinningTLSDialer(cfg Config, dialer TLSDialer) *PinningTLSDialer + func (p *PinningTLSDialer) DialTLS(network, address string) (net.Conn, error) + type ProxyTLSDialer struct + func NewProxyTLSDialer(cfg Config, dialer TLSDialer) *ProxyTLSDialer + func (d *ProxyTLSDialer) AllowProxy() + func (d *ProxyTLSDialer) DialTLS(network, address string) (net.Conn, error) + func (d *ProxyTLSDialer) DisallowProxy() + type PublicKey struct + Flags int + PublicKey string + type RecipientType int + const RecipientTypeExternal + const RecipientTypeInternal + type SendMessageReq struct + ExpirationTime int64 + Packages []*MessagePackage + func NewSendMessageReq(kr *crypto.KeyRing, mimeBody, plainBody, richBody string, ...) *SendMessageReq + func (req *SendMessageReq) AddRecipient(email string, sendScheme PackageFlag, pubkey *crypto.KeyRing, ...) (err error) + func (req *SendMessageReq) PreparePackages() + type Signature struct + Data []byte + Hash string + type SignatureFlag int + func (p *SignatureFlag) Has(flag SignatureFlag) bool + func (p *SignatureFlag) HasNo(flag SignatureFlag) bool + func (p *SignatureFlag) Is(flag SignatureFlag) bool + type TLSDialer interface + DialTLS func(network, address string) (conn net.Conn, err error) + type TwoFAInfo struct + Enabled TwoFAStatus + type TwoFAStatus int + const TOTPAndU2FEnabled + const TOTPEnabled + const TwoFADisabled + const U2FEnabled + type User struct + Credit int + Currency string + Deliquent int + ID string + Keys PMKeys + MaxSpace *int64 + MaxUpload int64 + Name string + Private int + Role int + Services int + Subscribed int + UsedSpace *int64 + VPN struct{ ... }