]> gitweb.factorcode.org Git - factor.git/blob - basis/smtp/smtp-docs.factor
Merge git://projects.elasticdog.com/git/factor into public
[factor.git] / basis / smtp / smtp-docs.factor
1 ! Copyright (C) 2008 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors kernel quotations help.syntax help.markup
4 io.sockets strings calendar ;
5 IN: smtp
6
7 HELP: smtp-server
8 { $description "Holds an " { $link inet } " object with the address of an SMTP server." } ;
9
10 HELP: smtp-read-timeout
11 { $description "Holds an " { $link duration } " object that specifies how long to wait for a response from the SMTP server." } ;
12
13 HELP: with-smtp-connection
14 { $values { "quot" quotation } }
15 { $description "Connects to an SMTP server stored in " { $link smtp-server } " and calls the quotation." } ;
16
17 HELP: <email>
18 { $values { "email" email } }
19 { $description "Creates an empty " { $link email } " object." } ;
20
21 HELP: send-email
22 { $values { "email" email } }
23 { $description "Sends an " { $link email } " object to an STMP server stored in the " { $link smtp-server } " variable.  The required slots are " { $snippet "from" } " and " { $snippet "to" } "." }
24
25 { $examples
26     { $unchecked-example "USING: accessors smtp ;"
27     "<email>"
28     "    \"groucho@marx.bros\" >>from"
29     "    { \"chico@marx.bros\" \"harpo@marx.bros\" } >>to"
30     "    { \"gummo@marx.bros\" } >>cc"
31     "    { \"zeppo@marx.bros\" } >>bcc"
32     "    \"Pickup line\" >>subject"
33     "    \"If I said you had a beautiful body, would you hold it against me?\" >>body"
34     "send-email"
35     ""
36     }
37 } ;
38
39 ARTICLE: "smtp" "SMTP Client Library"
40 "Start by creating a new email object:"
41 { $subsection <email> }
42 "Set the " { $snippet "from" } " slot to a " { $link string } "." $nl
43 "Set the recipient fields, " { $snippet "to" } ", " { $snippet "cc" } ", and " { $snippet "bcc" } ", to arrays of strings."
44 "Set the " { $snippet "subject" } " to a " { $link string } "." $nl
45 "Set the " { $snippet "body" } " to a " { $link string } "." $nl ;