-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Compose MIME email messages.
--   
--   Hackage documentation generation is not reliable. For up to date
--   documentation, please see:
--   <a>http://www.stackage.org/package/mime-mail</a>.
@package mime-mail
@version 0.4.13.1

module Network.Mail.Mime

-- | MIME boundary between parts of a message.
newtype Boundary
Boundary :: Text -> Boundary
[unBoundary] :: Boundary -> Text

-- | An entire mail message.
data Mail
Mail :: Address -> [Address] -> [Address] -> [Address] -> Headers -> [Alternatives] -> Mail
[mailFrom] :: Mail -> Address
[mailTo] :: Mail -> [Address]
[mailCc] :: Mail -> [Address]
[mailBcc] :: Mail -> [Address]

-- | Other headers, excluding from, to, cc and bcc.
[mailHeaders] :: Mail -> Headers

-- | A list of different sets of alternatives. As a concrete example:
--   
--   <pre>
--   mailParts = [ [textVersion, htmlVersion], [attachment1], [attachment1]]
--   </pre>
--   
--   Make sure when specifying alternatives to place the most preferred
--   version last.
[mailParts] :: Mail -> [Alternatives]

-- | A mail message with the provided <tt>from</tt> address and no other
--   fields filled in.
emptyMail :: Address -> Mail
data Address
Address :: Maybe Text -> Text -> Address
[addressName] :: Address -> Maybe Text
[addressEmail] :: Address -> Text

-- | Multiple alternative representations of the same data. For example,
--   you could provide a plain-text and HTML version of a message.
type Alternatives = [Part]

-- | A single part of a multipart message.
data Part
Part :: Text -> Encoding -> Maybe Text -> Headers -> ByteString -> Part

-- | content type
[partType] :: Part -> Text
[partEncoding] :: Part -> Encoding

-- | The filename for this part, if it is to be sent with an attachemnt
--   disposition.
[partFilename] :: Part -> Maybe Text
[partHeaders] :: Part -> Headers
[partContent] :: Part -> ByteString

-- | How to encode a single part. You should use <a>Base64</a> for binary
--   data.
data Encoding
None :: Encoding
Base64 :: Encoding
QuotedPrintableText :: Encoding
QuotedPrintableBinary :: Encoding
type Headers = [(ByteString, Text)]

-- | Render a <a>Mail</a> with a given <a>RandomGen</a> for producing
--   boundaries.
renderMail :: RandomGen g => g -> Mail -> (ByteString, g)

-- | Like <a>renderMail</a>, but generates a random boundary.
renderMail' :: Mail -> IO ByteString

-- | Send a fully-formed email message via the default sendmail executable
--   with default options.
sendmail :: ByteString -> IO ()

-- | Send a fully-formed email message via the specified sendmail
--   executable with specified options.
sendmailCustom :: FilePath -> [String] -> ByteString -> IO ()

-- | Like <a>sendmailCustom</a>, but also returns sendmail's output to
--   stderr and stdout as strict ByteStrings.
--   
--   Since 0.4.9
sendmailCustomCaptureOutput :: FilePath -> [String] -> ByteString -> IO (ByteString, ByteString)

-- | Render an email message and send via the default sendmail executable
--   with default options.
renderSendMail :: Mail -> IO ()

-- | Render an email message and send via the specified sendmail executable
--   with specified options.
renderSendMailCustom :: FilePath -> [String] -> Mail -> IO ()

-- | 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.
simpleMail :: Address -> Address -> Text -> Text -> Text -> [(Text, FilePath)] -> IO Mail

-- | A simple interface for generating an email with only plain-text body.
simpleMail' :: Address -> Address -> Text -> Text -> Mail

-- | A simple interface for generating an email with HTML and plain-text
--   alternatives and some <tt>ByteString</tt> attachments.
--   
--   Since 0.4.7
simpleMailInMemory :: Address -> Address -> Text -> Text -> Text -> [(Text, Text, ByteString)] -> Mail

-- | Add an <tt>Alternative</tt> to the <a>Mail</a>s parts.
--   
--   To e.g. add a plain text body use &gt; addPart [plainPart body]
--   (emptyMail from)
addPart :: Alternatives -> Mail -> Mail

-- | Add an attachment from a file and construct a <a>Part</a>.
addAttachment :: Text -> FilePath -> Mail -> IO Mail

-- | Add an attachment from a file and construct a <a>Part</a> with the
--   specified content id in the Content-ID header.
addAttachmentCid :: Text -> FilePath -> Text -> Mail -> IO Mail
addAttachments :: [(Text, FilePath)] -> Mail -> IO Mail

-- | Add an attachment from a <tt>ByteString</tt> and construct a
--   <a>Part</a>.
--   
--   Since 0.4.7
addAttachmentBS :: Text -> Text -> ByteString -> Mail -> Mail

addAttachmentBSCid :: Text -> Text -> ByteString -> Text -> Mail -> Mail

-- | Since 0.4.7
addAttachmentsBS :: [(Text, Text, ByteString)] -> Mail -> Mail

-- | Format an E-Mail address according to the name-addr form (see: RFC5322
--   § 3.4 "Address specification", i.e: [display-name]
--   '&lt;'addr-spec'&gt;') This can be handy for adding custom headers
--   that require such format.
renderAddress :: Address -> Text

-- | Construct a UTF-8-encoded html <a>Part</a>.
htmlPart :: Text -> Part

-- | Construct a UTF-8-encoded plain-text <a>Part</a>.
plainPart :: Text -> Part

-- | Generates a random sequence of alphanumerics of the given length.
randomString :: RandomGen d => Int -> d -> (String, d)

-- | The first parameter denotes whether the input should be treated as
--   text. If treated as text, then CRs will be stripped and LFs output as
--   CRLFs. If binary, then CRs and LFs will be escaped.
quotedPrintable :: Bool -> ByteString -> Builder
instance GHC.Classes.Eq Network.Mail.Mime.QPC
instance GHC.Show.Show Network.Mail.Mime.Mail
instance GHC.Show.Show Network.Mail.Mime.Part
instance GHC.Classes.Eq Network.Mail.Mime.Part
instance GHC.Show.Show Network.Mail.Mime.Encoding
instance GHC.Classes.Eq Network.Mail.Mime.Encoding
instance GHC.Show.Show Network.Mail.Mime.Address
instance GHC.Classes.Eq Network.Mail.Mime.Address
instance GHC.Show.Show Network.Mail.Mime.Boundary
instance GHC.Classes.Eq Network.Mail.Mime.Boundary
instance System.Random.Random Network.Mail.Mime.Boundary
