smtp-mail-0.3.0.0: Simple email sending via SMTP

Safe Haskell | None
Language | Haskell2010

Network.Mail.SMTP

Contents

- Main interface
- Types
- Network.Mail.Mime's sendmail interface (reexports)
- Establishing Connection
- Operation to a Connection

Synopsis

- sendMail :: HostName -> Mail -> IO ()
- sendMail' :: HostName -> PortNumber -> Mail -> IO ()
- sendMailWithLogin :: HostName -> UserName -> Password -> Mail -> IO ()
- sendMailWithLogin' :: HostName -> PortNumber -> UserName -> Password -> Mail -> IO ()
- sendMailWithSender :: ByteString -> HostName -> Mail -> IO ()
- sendMailWithSender' :: ByteString -> HostName -> PortNumber -> Mail -> IO ()
- sendMailTLS :: HostName -> Mail -> IO ()
- sendMailTLS' :: HostName -> PortNumber -> Mail -> IO ()
- sendMailWithLoginTLS :: HostName -> UserName -> Password -> Mail -> IO ()
- sendMailWithLoginTLS' :: HostName -> PortNumber -> UserName -> Password -> Mail -> IO ()
- sendMailWithSenderTLS :: ByteString -> HostName -> Mail -> IO ()
- sendMailWithSenderTLS' :: ByteString -> HostName -> PortNumber -> Mail -> IO ()
- sendMailSTARTTLS :: HostName -> Mail -> IO ()
- sendMailSTARTTLS' :: HostName -> PortNumber -> Mail -> IO ()
- sendMailWithLoginSTARTTLS :: HostName -> UserName -> Password -> Mail -> IO ()
- sendMailWithLoginSTARTTLS' :: HostName -> PortNumber -> UserName -> Password -> Mail -> IO ()
- sendMailWithSenderSTARTTLS :: ByteString -> HostName -> Mail -> IO ()
- sendMailWithSenderSTARTTLS' :: ByteString -> HostName -> PortNumber -> Mail -> IO ()
- simpleMail :: Address -> [Address] -> [Address] -> [Address] -> Text -> [Part] -> Mail
- plainTextPart :: Text -> Part
- htmlPart :: Text -> Part
- filePart :: Text -> FilePath -> IO Part
- module Network.Mail.SMTP.Types
- data SMTPConnection
- sendmail :: ByteString -> IO ()
- sendmailCustom :: FilePath -> [String] -> ByteString -> IO ()
- renderSendMail :: Mail -> IO ()
- renderSendMailCustom :: FilePath -> [String] -> Mail -> IO ()
- connectSMTP :: HostName -> IO SMTPConnection
- connectSMTPS :: HostName -> IO SMTPConnection
- connectSMTPSTARTTLS :: HostName -> IO SMTPConnection
- connectSMTP' :: HostName -> PortNumber -> IO SMTPConnection
- connectSMTPS' :: HostName -> PortNumber -> IO SMTPConnection
- connectSMTPSTARTTLS' :: HostName -> PortNumber -> IO SMTPConnection
- connectSMTPWithHostName :: HostName -> PortNumber -> IO String -> IO SMTPConnection
- connectSMTPWithHostNameAndTlsSettings :: HostName -> PortNumber -> IO String -> Maybe TLSSettings -> IO SMTPConnection
- connectSMTPWithHostNameAndTlsSettingsSTARTTLS :: HostName -> PortNumber -> IO String -> TLSSettings -> IO SMTPConnection
- sendCommand :: SMTPConnection -> Command -> IO (ReplyCode, ByteString)
- login :: SMTPConnection -> UserName -> Password -> IO (ReplyCode, ByteString)
- closeSMTP :: SMTPConnection -> IO ()
- renderAndSend :: SMTPConnection -> Mail -> IO ()
- renderAndSendFrom :: ByteString -> SMTPConnection -> Mail -> IO ()

# Main interface

sendMail :: HostName -> Mail -> IO () Source #

Connect to an SMTP server, send a `Mail`, then disconnect. Uses the default port (25).

sendMail' :: HostName -> PortNumber -> Mail -> IO () Source #

Connect to an SMTP server, send a `Mail`, then disconnect.

sendMailWithLogin :: HostName -> UserName -> Password -> Mail -> IO () Source #

Connect to an SMTP server, login, send a `Mail`, disconnect. Uses the default port (25).

sendMailWithLogin' :: HostName -> PortNumber -> UserName -> Password -> Mail -> IO () Source #

Connect to an SMTP server, login, send a `Mail`, disconnect.

sendMailWithSender :: ByteString -> HostName -> Mail -> IO () Source #

Send a `Mail` with a given sender.

sendMailWithSender' :: ByteString -> HostName -> PortNumber -> Mail -> IO () Source #

Send a `Mail` with a given sender.

sendMailTLS :: HostName -> Mail -> IO () Source #

Connect to an SMTP server, send a `Mail`, then disconnect. Uses SMTPS with the default port (465).

sendMailTLS' :: HostName -> PortNumber -> Mail -> IO () Source #

Connect to an SMTP server, send a `Mail`, then disconnect. Uses SMTPS.

sendMailWithLoginTLS :: HostName -> UserName -> Password -> Mail -> IO () Source #

Connect to an SMTP server, login, send a `Mail`, disconnect. Uses SMTPS with its default port (465).

sendMailWithLoginTLS' :: HostName -> PortNumber -> UserName -> Password -> Mail -> IO () Source #

Connect to an SMTP server, login, send a `Mail`, disconnect. Uses SMTPS.

sendMailWithSenderTLS :: ByteString -> HostName -> Mail -> IO () Source #

Send a `Mail` with a given sender. Uses SMTPS with its default port (465).

sendMailWithSenderTLS' :: ByteString -> HostName -> PortNumber -> Mail -> IO () Source #

Send a `Mail` with a given sender. Uses SMTPS.

sendMailSTARTTLS :: HostName -> Mail -> IO () Source #

Connect to an SMTP server, send a `Mail`, then disconnect. Uses STARTTLS with the default port (587).

sendMailSTARTTLS' :: HostName -> PortNumber -> Mail -> IO () Source #

Connect to an SMTP server, send a `Mail`, then disconnect. Uses STARTTLS.

sendMailWithLoginSTARTTLS :: HostName -> UserName -> Password -> Mail -> IO () Source #

Connect to an SMTP server, login, send a `Mail`, disconnect. Uses STARTTLS with the default port (587).

sendMailWithLoginSTARTTLS' :: HostName -> PortNumber -> UserName -> Password -> Mail -> IO () Source #

Connect to an SMTP server, login, send a `Mail`, disconnect. Uses STARTTLS.

sendMailWithSenderSTARTTLS :: ByteString -> HostName -> Mail -> IO () Source #

Send a `Mail` with a given sender. Uses STARTTLS with the default port (587).

sendMailWithSenderSTARTTLS' :: ByteString -> HostName -> PortNumber -> Mail -> IO () Source #

Send a `Mail` with a given sender. Uses STARTTLS.

simpleMail Source #

Arguments

:: Address | from
-> [Address] | to
-> [Address] | CC
-> [Address] | BCC
-> Text | subject
-> [Part] | list of parts (list your preferred part last)
-> Mail |

A simple interface for generating a `Mail` with a plantext body and an optional HTML body.

plainTextPart :: Text -> Part Source #

Deprecated: Use plainPart from mime-mail package

Construct a plain text `Part`

htmlPart :: Text -> Part Source #

Deprecated: Use htmlPart from mime-mail package

Construct an html `Part`

filePart Source #

Arguments

:: Text | content type
-> FilePath | path to file
-> IO Part |

Deprecated: Use filePart from mime-mail package

Construct a file attachment `Part`

# Types

module Network.Mail.SMTP.Types

data SMTPConnection Source #

#### Instances

Instances details

Eq SMTPConnection Source # |
Instance details Defined in Network.Mail.SMTP Methods (==) :: SMTPConnection -> SMTPConnection -> Bool (/=) :: SMTPConnection -> SMTPConnection -> Bool

# Network.Mail.Mime's sendmail interface (reexports)

sendmail :: ByteString -> IO () Source #

Send a fully-formed email message via the default sendmail executable with default options.

sendmailCustom Source #

Arguments

:: FilePath | sendmail executable path
-> [String] | sendmail command-line options
-> ByteString | mail message as lazy bytestring
-> IO () |

Send a fully-formed email message via the specified sendmail executable with specified options.

renderSendMail :: Mail -> IO () Source #

Render an email message and send via the default sendmail executable with default options.

renderSendMailCustom Source #

Arguments

:: FilePath | sendmail executable path
-> [String] | sendmail command-line options
-> Mail | mail to render and send
-> IO () |

Render an email message and send via the specified sendmail executable with specified options.

# Establishing Connection

connectSMTP Source #

Arguments

:: HostName | name of the server
-> IO SMTPConnection |

Connect to an SMTP server with the specified host and default port (25)

connectSMTPS Source #

Arguments

:: HostName | name of the server
-> IO SMTPConnection |

Connect to an SMTP server with the specified host via SMTPS on port (465). According to RFC 8314 this should be preferred over STARTTLS if the server offers it. If you need a different port number or more sophisticated `TLSSettings` use `connectSMTPWithHostNameAndTlsSettings`.

connectSMTPSTARTTLS Source #

Arguments

:: HostName | name of the server
-> IO SMTPConnection |

Connect to an SMTP server with the specified host and default port (587). Uses STARTTLS

connectSMTP' Source #

Arguments

:: HostName | name of the server
-> PortNumber | port number
-> IO SMTPConnection |

Connect to an SMTP server with the specified host and port

connectSMTPS' Source #

Arguments

:: HostName | name of the server
-> PortNumber | port number
-> IO SMTPConnection |

Connect to an SMTP server with the specified host and port using TLS

connectSMTPSTARTTLS' Source #

Arguments

:: HostName | name of the server
-> PortNumber | port number
-> IO SMTPConnection |

Connect to an SMTP server with the specified host and port using STARTTLS

connectSMTPWithHostName Source #

Arguments

:: HostName | name of the server
-> PortNumber | port number
-> IO String | Returns the host name to use to send from
-> IO SMTPConnection |

Connect to an SMTP server with the specified host and port

connectSMTPWithHostNameAndTlsSettings Source #

Arguments

:: HostName | name of the server
-> PortNumber | port number
-> IO String | Returns the host name to use to send from
-> Maybe TLSSettings | optional TLS parameters
-> IO SMTPConnection |

Connect to an SMTP server with the specified host and port and maybe via TLS

connectSMTPWithHostNameAndTlsSettingsSTARTTLS Source #

Arguments

:: HostName | name of the server
-> PortNumber | port number
-> IO String | Returns the host name to use to send from
-> TLSSettings | TLS parameters
-> IO SMTPConnection |

Connect to an SMTP server with the specified host and port using STARTTLS

# Operation to a Connection

sendCommand :: SMTPConnection -> Command -> IO (ReplyCode, ByteString) Source #

Send a `Command` to the SMTP server

login :: SMTPConnection -> UserName -> Password -> IO (ReplyCode, ByteString) Source #

A convenience function that sends `AUTH` `LOGIN` to the server

closeSMTP :: SMTPConnection -> IO () Source #

Send `QUIT` and close the connection.

renderAndSend :: SMTPConnection -> Mail -> IO () Source #

Render a `Mail` to a `ByteString` then send it over the specified `SMTPConnection`

renderAndSendFrom :: ByteString -> SMTPConnection -> Mail -> IO () Source #