| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Network.Mail.Mailtrap
Description
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
- getInboxes :: Token -> AccountID -> IO [Inbox]
- newtype InboxMessageID = InboxMessageID Int
- 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 NamedEmailAddress = NamedEmailAddress {}
- parseEmailAddress :: ByteString -> Either String EmailAddress
- 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.
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. |
Instances
| Exception Exception Source # | |
Defined in Network.Mail.Mailtrap Methods toException :: Exception -> SomeException # fromException :: SomeException -> Maybe Exception # displayException :: Exception -> String # | |
| Show Exception Source # | |
Accounts
Mailtrap account ID.
Mailtrap account.
Constructors
| Account | |
Fields
| |
Attachments
data Disposition Source #
Attachment disposition.
Instances
| Show Disposition Source # | |
Defined in Network.Mail.Mailtrap Methods 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.
Constructors
| Attachment | |
Fields
| |
Instances
| ToJSON Attachment Source # | |
Defined in Network.Mail.Mailtrap Methods toJSON :: Attachment -> Value # toEncoding :: Attachment -> Encoding # toJSONList :: [Attachment] -> Value # toEncodingList :: [Attachment] -> Encoding # | |
| Show Attachment Source # | |
Defined in Network.Mail.Mailtrap Methods 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.
Constructors
| Template | |
Fields
| |
Testing inboxes
Testing inbox identifier.
newtype InboxMessageID Source #
Inbox message identifier.
Constructors
| InboxMessageID Int |
Instances
| FromJSON InboxMessageID Source # | |
Defined in Network.Mail.Mailtrap Methods parseJSON :: Value -> Parser InboxMessageID # parseJSONList :: Value -> Parser [InboxMessageID] # | |
| Show InboxMessageID Source # | |
Defined in Network.Mail.Mailtrap Methods showsPrec :: Int -> InboxMessageID -> ShowS # show :: InboxMessageID -> String # showList :: [InboxMessageID] -> ShowS # | |
| Eq InboxMessageID Source # | |
Defined in Network.Mail.Mailtrap Methods (==) :: InboxMessageID -> InboxMessageID -> Bool # (/=) :: InboxMessageID -> InboxMessageID -> Bool # | |
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 NamedEmailAddress Source #
An e-mail address with a name.
Constructors
| NamedEmailAddress | |
Fields | |
Instances
| ToJSON NamedEmailAddress Source # | |
Defined in Network.Mail.Mailtrap Methods toJSON :: NamedEmailAddress -> Value # toEncoding :: NamedEmailAddress -> Encoding # toJSONList :: [NamedEmailAddress] -> Value # toEncodingList :: [NamedEmailAddress] -> Encoding # | |
| Show NamedEmailAddress Source # | |
Defined in Network.Mail.Mailtrap Methods showsPrec :: Int -> NamedEmailAddress -> ShowS # show :: NamedEmailAddress -> String # showList :: [NamedEmailAddress] -> ShowS # | |
parseEmailAddress :: ByteString -> Either String EmailAddress Source #
Attempt to parse an e-mail address
Production message identifier.
E-mail message, including subject and body.
Constructors
| Message | |
Fields
| |
An e-mail body.
Constructors
| 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.
Constructors
Fields
| |
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).