]> gitweb.michael.orlitzky.com - dead/halcyon.git/blobdiff - src/Mail.hs
Accept a sendmail_path on the command line.
[dead/halcyon.git] / src / Mail.hs
index 2da56639667b4b2b63d387aaab601934091f5f7e..2e86a204e003ceda90bfb32994fe4e83f386ad48 100644 (file)
@@ -33,7 +33,7 @@ default_headers = ["MIME-Version: 1.0",
 
 -- |Showing a message will print it in roughly RFC-compliant
 -- form. This form is sufficient for handing the message off to
--- sendmail.
+-- sendmail (or compatible).
 instance Show Message where
     show m =
         concat [ if (length (headers m) == 0) then "" else (intercalate "\n" (headers m)) ++ "\n",
@@ -65,14 +65,14 @@ rfc822_now = do
 
 
 -- |Takes a message as an argument, and passes it to the system's
--- sendmail binary.
-sendmail :: Message -> IO (String, String, ExitCode)
-sendmail message = do
+-- sendmail (or compatible) binary.
+sendmail :: FilePath -> Message -> IO (String, String, ExitCode)
+sendmail sendmail_path message = do
   let sendmail_args = ["-f",
                        (from message)]
 
   (inh, outh, errh, ph) <-
-      runInteractiveProcess "/usr/bin/sendmail" sendmail_args Nothing Nothing
+      runInteractiveProcess sendmail_path sendmail_args Nothing Nothing
 
   outm <- newEmptyMVar
   outs <- hGetContents outh