- newtype Boundary = Boundary {
- unBoundary :: String
- data Mail = Mail {
- mailHeaders :: [(String, String)]
- mailParts :: [Alternatives]
- type Alternatives = [Part]
- data Part = Part {}
- data Encoding
- renderMail :: RandomGen g => g -> Mail -> (ByteString, g)
- renderMail' :: Mail -> IO ByteString
- sendmail :: ByteString -> IO ()
- renderSendMail :: Mail -> IO ()
- simpleMail :: String -> String -> String -> Text -> Text -> [(String, FilePath)] -> IO Mail
- randomString :: RandomGen d => Int -> d -> (String, d)
Datatypes
MIME boundary between parts of a message.
An entire mail message.
|
type Alternatives = [Part]Source
Multiple alternative representations of the same data. For example, you could provide a plain-text and HTML version of a message.
A single part of a multipart message.
Part | |
|
Render a message
renderMail :: RandomGen g => g -> Mail -> (ByteString, g)Source
renderMail' :: Mail -> IO ByteStringSource
Like renderMail
, but generates a random boundary.
Sending messages
sendmail :: ByteString -> IO ()Source
Send a fully-formed email message via the sendmail executable.
High-level Mail
creation
:: String | to |
-> String | from |
-> String | subject |
-> Text | plain body |
-> Text | HTML body |
-> [(String, FilePath)] | content type and path of attachments |
-> IO Mail |
A simple interface for generating an email with HTML and plain-text alternatives and some file attachments.
Note that we use lazy IO for reading in the attachment contents.
Utilities
randomString :: RandomGen d => Int -> d -> (String, d)Source
Generates a random sequence of alphanumerics of the given length.