PasteRack.org
Paste # 60536
2015-05-22 08:51:24

Fork as a new paste.

Paste viewed 116 times.


Embed:

notes file keeper

#!/usr/bin/env racket
#lang racket
(require racket/cmdline
         racket/date
         net/sendmail)

(define text (string-join
              (vector->list (current-command-line-arguments)) " "))

(define out (open-output-file
             (expand-user-path "~/messages")
             #:exists 'append))

(define body (format "~a [~a]\n" text (date->string (current-date))))
(fprintf out body)
(close-output-port out)

(send-mail-message "sender"
                   "new note"
                   '("to@example.com")
                   '("cc@example.com")
                   '("bcc@example.com")
                   (string-split text "\n"))