source: project/wiki/eggref/4/send-grid @ 32653

Last change on this file since 32653 was 32653, checked in by svnwiki, 5 years ago

Anonymous wiki edit for IP [127.0.0.1]: Add documentation for newly supported file attachments.

File size: 2.2 KB
Line 
1== Send Grid
2
3[[toc:]]
4
5=== Description
6
7Provides a very simply api for sending email via [[http://sendgrid.com/|SendGrid]]. The api uses SendGrid's [[http://docs.sendgrid.com/documentation/api/web-api/mail/|web api]]. Currently only the sending of mail is supported, but other parts of the web api could be easily added.
8
9=== Repository
10
11[[https://github.com/ThomasHintz/chicken-scheme-send-grid]]
12
13=== Author
14
15[[/users/thomas-hintz|Thomas Hintz]]
16
17Contact me at t@thintz.com.
18
19=== Requirements
20
21* [[HTTP Client]]
22* [[URI Common]]
23* [[Intarweb]]
24* [[JSON]]
25* [[SRFI-1]]
26* [[SRFI-18]]
27
28=== List of Parameters
29
30==== {{api-user}}
31<parameter>(api-user user)</parameter>
32
33This is your SendGrid api user specified as a string.
34
35==== {{api-key}}
36<parameter>(api-key key)</parameter>
37
38This is your SendGrid api key specified as a string.
39
40=== List of Procedures
41
42==== {{send-mail}}
43<procedure>(send-mail #!key (subject #f) (text #f) (html #f) (from #f) (from-name #f) (to #f) (reply-to #f) (api-user (api-user)) (api-key (api-key)) files)</procedure>
44
45Takes all the required arguments, passes a request on to SendGrid, and returns the SendGrid response in list form. {{api-user}} and {{api-key}} are optional if you specified them as parameters.
46
47Only {{html}} or {{text}} needs to be specified. If {{html}} is specified, then the resulting email will be in HTML format. If both {{html}} and {{text}} are specified, then the resulting email will only include the contents of {{html}}.
48
49{{files}} is optional and is a list of alists containing file attachments. The alist for each file must contain the key {{filename}} -- a string, {{filepath}} -- a string, and {{content-type}} -- a symbol. Example:
50
51<enscript highlight=scheme>
52((filepath "/foo.txt") (filename "foo.txt") (content-type text/plain))
53</enscript>
54
55
56=== Example
57
58<enscript highlight=scheme>
59(use send-grid)
60
61(api-user "api-user")
62(api-key "api-key")
63
64(send-mail from: "example.from@example.org" to: "example.to@example.org" from-name: "Example Name" reply-to: "example-from@example.org" subject: "Example Subject" text: "Example text.")
65</enscript>
66
67=== Version History
68
69==== Version 2.0.1
70Add support for file attachments. (Thanks to Sven Hartrumpf)
71==== Version 2
72Fix some install bugs.
73==== Version 1
74Initial release.
Note: See TracBrowser for help on using the repository browser.