Module Mail

This library contains operations for sending emails. The implementation might need to be adapted to the local environment.

Author: Michael Hanus

Version: February 2021

Summary of exported operations:

sendMail :: String -> String -> String -> String -> IO ()   
Sends an email via mailx command.
sendMailWithOptions :: String -> String -> [MailOption] -> String -> IO ()   
Sends an email via mailx command and various options.

Exported datatypes:


MailOption

Options for sending emails.

Constructors:

  • CC :: String -> MailOption : recipient of a carbon copy
  • BCC :: String -> MailOption : recipient of a blind carbon copy
  • TO :: String -> MailOption : recipient of the email

Exported operations:

sendMail :: String -> String -> String -> String -> IO ()   

Sends an email via mailx command.

Example call:
(sendMail from to subject contents)
Parameters:
  • from : the email address of the sender
  • to : the email address of the recipient
  • subject : the subject of the email
  • contents : the contents of the email

sendMailWithOptions :: String -> String -> [MailOption] -> String -> IO ()   

Sends an email via mailx command and various options. Note that multiple options are allowed, e.g., more than one CC option for multiple recipient of carbon copies.

Important note: The implementation of this operation is based on the command "mailx" and must be adapted according to your local environment!

Example call:
(sendMailWithOptions from subject options contents)
Parameters:
  • from : the email address of the sender
  • subject : the subject of the email
  • options : send options, e.g., multiple recipients
  • contents : the contents of the email