mailtrap-0.1.0.0: Mailtrap API library.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Network.Mail.Mailtrap

Description

Mailtrap API.

Synopsis

Tokens

newtype Token Source #

Authorization token.

Constructors

Token Text 

Instances

Instances details
Show Token Source # 
Instance details

Defined in Network.Mail.Mailtrap

Methods

showsPrec :: Int -> Token -> ShowS #

show :: Token -> String #

showList :: [Token] -> ShowS #

Eq Token Source # 
Instance details

Defined in Network.Mail.Mailtrap

Methods

(==) :: Token -> Token -> Bool #

(/=) :: Token -> Token -> Bool #

data Exception Source #

Exceptions thrown by functions from this module.

Constructors

MultipleErrors Int [Text]

API request returned list of errors. HTTP status code and error messages.

SingleError Int Text

API request returned a single error message. HTTP status code and error message.

ParsingError ByteString String

Parsing failed. Input that failed to parse plus error message.

Accounts

newtype AccountID Source #

Mailtrap account ID.

Constructors

AccountID Int 

Instances

Instances details
FromJSON AccountID Source # 
Instance details

Defined in Network.Mail.Mailtrap

Show AccountID Source # 
Instance details

Defined in Network.Mail.Mailtrap

Eq AccountID Source # 
Instance details

Defined in Network.Mail.Mailtrap

data Account Source #

Mailtrap account.

Constructors

Account 

Instances

Instances details
FromJSON Account Source # 
Instance details

Defined in Network.Mail.Mailtrap

Show Account Source # 
Instance details

Defined in Network.Mail.Mailtrap

getAllAccounts :: Token -> IO [Account] Source #

Get all the accounts the given token has access to.

Attachments

data Disposition Source #

Attachment disposition.

Constructors

Inline Text

Inline with identifier.

Attached 

Instances

Instances details
Show Disposition Source # 
Instance details

Defined in Network.Mail.Mailtrap

setDisposition :: Disposition -> Attachment -> Attachment Source #

Set an attachment's disposition.

data Attachment Source #

File that can be attached to an e-mail.

Constructors

Attachment 

Fields

Instances

Instances details
ToJSON Attachment Source # 
Instance details

Defined in Network.Mail.Mailtrap

Show Attachment Source # 
Instance details

Defined in Network.Mail.Mailtrap

attachmentFromFile :: FilePath -> IO Attachment Source #

Create an attachment from a file. It guesses the mime type from the file extension. Disposition is set to Attached. The file is read strictly.

Templates

data Template Source #

Template that can be used when sending e-mails.

Constructors

Template 

Fields

Instances

Instances details
Show Template Source # 
Instance details

Defined in Network.Mail.Mailtrap

template :: UUID -> Template Source #

Template with no variable set.

setTemplateVariable :: ToJSON a => Text -> a -> Template -> Template Source #

Set template variable.

Testing inboxes

newtype InboxID Source #

Testing inbox identifier.

Constructors

InboxID Int 

Instances

Instances details
FromJSON InboxID Source # 
Instance details

Defined in Network.Mail.Mailtrap

Show InboxID Source # 
Instance details

Defined in Network.Mail.Mailtrap

Eq InboxID Source # 
Instance details

Defined in Network.Mail.Mailtrap

Methods

(==) :: InboxID -> InboxID -> Bool #

(/=) :: InboxID -> InboxID -> Bool #

getInboxes :: Token -> AccountID -> IO [Inbox] Source #

Get all inboxes from an account.

newtype InboxMessageID Source #

Inbox message identifier.

Constructors

InboxMessageID Int 

getInboxMessages :: Token -> AccountID -> InboxID -> IO [InboxMessage] Source #

Get all inbox messages from an testing inbox.

downloadMessageRaw :: Token -> AccountID -> InboxID -> InboxMessageID -> IO Text Source #

Download inbox message raw email body.

downloadMessageEML :: Token -> AccountID -> InboxID -> InboxMessageID -> IO Text Source #

Download inbox message in EML format.

downloadMessageText :: Token -> AccountID -> InboxID -> InboxMessageID -> IO Text Source #

Download inbox message text part.

downloadMessageHTML :: Token -> AccountID -> InboxID -> InboxMessageID -> IO Text Source #

Download inbox message HTML part.

Sending e-mails

parseEmailAddress :: ByteString -> Either String EmailAddress Source #

Attempt to parse an e-mail address

newtype MessageID Source #

Production message identifier.

Constructors

MessageID UUID 

Instances

Instances details
FromJSON MessageID Source # 
Instance details

Defined in Network.Mail.Mailtrap

Show MessageID Source # 
Instance details

Defined in Network.Mail.Mailtrap

Eq MessageID Source # 
Instance details

Defined in Network.Mail.Mailtrap

data Message Source #

E-mail message, including subject and body.

Constructors

Message 

data EmailBody Source #

An e-mail body.

Constructors

PlainTextBody Text

Plain-text body.

HTMLOnlyBody Html

HTML-only body.

HTMLBody Html Text

HTML body with text fallback.

data Email Source #

E-mail that can be sent using sendEmail.

Constructors

Email 

Fields

Instances

Instances details
ToJSON Email Source # 
Instance details

Defined in Network.Mail.Mailtrap

sendEmail :: Token -> Email -> IO [MessageID] Source #

Send an e-mail and return the list of IDs of the messages sent (one per recipient).

sendTestEmail :: Token -> InboxID -> Email -> IO [InboxMessageID] Source #

Send a testing e-mail to the given inbox and return the list of IDs of the messages sent (one per recipient).