Safe Haskell | None |
---|---|
Language | Haskell2010 |
Mailtrap API.
Synopsis
- newtype Token = Token Text
- data Exception
- newtype AccountID = AccountID Int
- data Account = Account {}
- getAllAccounts :: Token -> IO [Account]
- data Disposition
- setDisposition :: Disposition -> Attachment -> Attachment
- data Attachment = Attachment {}
- attachmentFromFile :: FilePath -> IO Attachment
- data Template = Template {}
- template :: UUID -> Template
- setTemplateVariable :: ToJSON a => Text -> a -> Template -> Template
- newtype InboxID = InboxID Int
- data Inbox = Inbox {}
- getInboxes :: Token -> AccountID -> IO [Inbox]
- newtype InboxMessageID = InboxMessageID Int
- data InboxMessage = InboxMessage {}
- getInboxMessages :: Token -> AccountID -> InboxID -> IO [InboxMessage]
- downloadMessageRaw :: Token -> AccountID -> InboxID -> InboxMessageID -> IO Text
- downloadMessageEML :: Token -> AccountID -> InboxID -> InboxMessageID -> IO Text
- downloadMessageText :: Token -> AccountID -> InboxID -> InboxMessageID -> IO Text
- downloadMessageHTML :: Token -> AccountID -> InboxID -> InboxMessageID -> IO Text
- data EmailAddress
- parseEmailAddress :: ByteString -> Either String EmailAddress
- data NamedEmailAddress = NamedEmailAddress {}
- newtype MessageID = MessageID UUID
- data Message = Message {}
- data EmailBody
- data Email = Email {}
- sendEmail :: Token -> Email -> IO [MessageID]
- sendTestEmail :: Token -> InboxID -> Email -> IO [InboxMessageID]
Tokens
Authorization token.
Exceptions thrown by functions from this module.
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. |
Instances
Exception Exception Source # | |
Defined in Network.Mail.Mailtrap toException :: Exception -> SomeException # fromException :: SomeException -> Maybe Exception # displayException :: Exception -> String # | |
Show Exception Source # | |
Accounts
Mailtrap account ID.
Mailtrap account.
Attachments
data Disposition Source #
Attachment disposition.
Instances
Show Disposition Source # | |
Defined in Network.Mail.Mailtrap showsPrec :: Int -> Disposition -> ShowS # show :: Disposition -> String # showList :: [Disposition] -> ShowS # |
setDisposition :: Disposition -> Attachment -> Attachment Source #
Set an attachment's disposition.
data Attachment Source #
File that can be attached to an e-mail.
Attachment | |
|
Instances
ToJSON Attachment Source # | |
Defined in Network.Mail.Mailtrap toJSON :: Attachment -> Value # toEncoding :: Attachment -> Encoding # toJSONList :: [Attachment] -> Value # toEncodingList :: [Attachment] -> Encoding # omitField :: Attachment -> Bool # | |
Show Attachment Source # | |
Defined in Network.Mail.Mailtrap showsPrec :: Int -> Attachment -> ShowS # show :: Attachment -> String # showList :: [Attachment] -> ShowS # |
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
Template that can be used when sending e-mails.
Template | |
|
Testing inboxes
Testing inbox identifier.
Testing inbox.
Inbox | |
|
newtype InboxMessageID Source #
Inbox message identifier.
Instances
FromJSON InboxMessageID Source # | |
Defined in Network.Mail.Mailtrap parseJSON :: Value -> Parser InboxMessageID # parseJSONList :: Value -> Parser [InboxMessageID] # | |
Show InboxMessageID Source # | |
Defined in Network.Mail.Mailtrap showsPrec :: Int -> InboxMessageID -> ShowS # show :: InboxMessageID -> String # showList :: [InboxMessageID] -> ShowS # | |
Eq InboxMessageID Source # | |
Defined in Network.Mail.Mailtrap (==) :: InboxMessageID -> InboxMessageID -> Bool # (/=) :: InboxMessageID -> InboxMessageID -> Bool # |
data InboxMessage Source #
A message in a testing inbox.
Instances
FromJSON InboxMessage Source # | |
Defined in Network.Mail.Mailtrap parseJSON :: Value -> Parser InboxMessage # parseJSONList :: Value -> Parser [InboxMessage] # | |
Show InboxMessage Source # | |
Defined in Network.Mail.Mailtrap showsPrec :: Int -> InboxMessage -> ShowS # show :: InboxMessage -> String # showList :: [InboxMessage] -> ShowS # |
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
data EmailAddress #
Represents an email address.
Instances
parseEmailAddress :: ByteString -> Either String EmailAddress Source #
Attempt to parse an e-mail address
data NamedEmailAddress Source #
An e-mail address with a name.
Instances
ToJSON NamedEmailAddress Source # | |
Defined in Network.Mail.Mailtrap toJSON :: NamedEmailAddress -> Value # toEncoding :: NamedEmailAddress -> Encoding # toJSONList :: [NamedEmailAddress] -> Value # toEncodingList :: [NamedEmailAddress] -> Encoding # omitField :: NamedEmailAddress -> Bool # | |
Show NamedEmailAddress Source # | |
Defined in Network.Mail.Mailtrap showsPrec :: Int -> NamedEmailAddress -> ShowS # show :: NamedEmailAddress -> String # showList :: [NamedEmailAddress] -> ShowS # |
Production message identifier.
E-mail message, including subject and body.
Message | |
|
An e-mail body.
PlainTextBody Text | Plain-text body. |
HTMLOnlyBody Html | HTML-only body. |
HTMLBody Html Text | HTML body with text fallback. |
E-mail that can be sent using sendEmail
.
|
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).