Skip to content
Jas edited this page Jul 24, 2017 · 2 revisions

E-mail Sending via mailx

This library provides plain-text and HTML e-mail sending using the mailx command. The library assumes that mailx is already correctly configured to send e-mails.

NOTE: We expect the BSD version of mailx to be installed. If you're not sure which version you have, check man mailx and check what the -A parameter does. If it attaches a file, then it's the correct version. If it does anything else then it is not the right version.

If you do not have mailx set up, we use the Amazon Simple Email Service from our application hosts. Documentation to configure this can be found here.

.mail.send

The function takes a single dictionary argument:

  • Required keys
    • subject - String
    • to - Symbol (atom or list)
  • Optional keys
    • cc - Symbol (atom or list)
    • bcc - Symbol (atom or list)
    • body - String
    • attachments - File path (atom or list)
    • deleteAttachments - Boolean. Will delete attachments if e-mail is successfully sent

If <html> is found within the body string, the Content-Type header will be automatically added.

Example

q).mail.send `to`subject`body!(`$"jas@buabook.com";"Test Subject";"Body\n\nBody")
Sending e-mail [ To: `jas@buabook.com ] [ Subject: Test Subject ]
Running system command: "echo 'Body

Body' | mailx -s "Test Subject" "jas@buabook.com" "
1b
Clone this wiki locally