-- 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.5.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 -> Disposition -> Headers -> PartContent -> Part

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

-- | The filename for this part, if it is to be sent with an attachemnt
--   disposition.
[partDisposition] :: Part -> Disposition
[partHeaders] :: Part -> Headers
[partContent] :: Part -> PartContent

-- | NestedParts are for multipart-related: One HTML part and some inline
--   images
data PartContent
PartContent :: ByteString -> PartContent
NestedParts :: [Part] -> PartContent
data Disposition
AttachmentDisposition :: Text -> Disposition
InlineDisposition :: Text -> Disposition
DefaultDisposition :: Disposition

-- | 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
data InlineImage
InlineImage :: Text -> ImageContent -> Text -> InlineImage
[imageContentType] :: InlineImage -> Text
[imageContent] :: InlineImage -> ImageContent
[imageCID] :: InlineImage -> Text
data ImageContent
ImageFilePath :: FilePath -> ImageContent
ImageByteString :: ByteString -> ImageContent
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

-- | An interface for generating an email with HTML and plain-text
--   alternatives, some file attachments, and inline images. Note that we
--   use lazy IO for reading in the attachment and inlined images. Inline
--   images can be referred to from the HTML content using the
--   <tt>src="cid:{{CONTENT-ID}}"</tt> syntax, where CONTENT-ID is the
--   filename of the image.
--   
--   Since 0.5.0
simpleMailWithImages :: [Address] -> Address -> Text -> Text -> Text -> [InlineImage] -> [(Text, FilePath)] -> IO 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
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

-- | 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]
--   <a>&lt;</a>addr-spec<a>&gt;</a>) 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

-- | Construct a BASE64-encoded file attachment <a>Part</a>
--   
--   Since 0.5.0
filePart :: Text -> FilePath -> IO Part

-- | Construct a BASE64-encoded file attachment <a>Part</a>
--   
--   Since 0.5.0
filePartBS :: Text -> Text -> ByteString -> 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

-- | Add a <tt>Related</tt> Part
relatedPart :: [Part] -> Part

-- | Add an inline image from a file and construct a <a>Part</a>.
--   
--   Since 0.5.0
addImage :: InlineImage -> IO Part
mkImageParts :: [InlineImage] -> IO [Part]
instance GHC.Show.Show Network.Mail.Mime.Boundary
instance GHC.Classes.Eq Network.Mail.Mime.Boundary
instance GHC.Generics.Generic Network.Mail.Mime.Address
instance GHC.Show.Show Network.Mail.Mime.Address
instance GHC.Classes.Eq Network.Mail.Mime.Address
instance GHC.Generics.Generic Network.Mail.Mime.Encoding
instance GHC.Show.Show Network.Mail.Mime.Encoding
instance GHC.Classes.Eq Network.Mail.Mime.Encoding
instance GHC.Generics.Generic Network.Mail.Mime.Disposition
instance GHC.Classes.Eq Network.Mail.Mime.Disposition
instance GHC.Show.Show Network.Mail.Mime.Disposition
instance GHC.Generics.Generic Network.Mail.Mime.PartContent
instance GHC.Show.Show Network.Mail.Mime.PartContent
instance GHC.Classes.Eq Network.Mail.Mime.PartContent
instance GHC.Generics.Generic Network.Mail.Mime.Part
instance GHC.Show.Show Network.Mail.Mime.Part
instance GHC.Classes.Eq Network.Mail.Mime.Part
instance GHC.Generics.Generic Network.Mail.Mime.Mail
instance GHC.Show.Show Network.Mail.Mime.Mail
instance GHC.Show.Show Network.Mail.Mime.ImageContent
instance GHC.Show.Show Network.Mail.Mime.InlineImage
instance GHC.Classes.Eq Network.Mail.Mime.QPC
instance Data.String.IsString Network.Mail.Mime.Address
instance System.Random.Random Network.Mail.Mime.Boundary
