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 ;
8 { $description "Holds an " { $link inet } " object with the address of an SMTP server." } ;
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." } ;
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." } ;
18 { $values { "email" email } }
19 { $description "Creates an empty " { $link email } " object." } ;
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" } "." }
26 { $unchecked-example "USING: accessors smtp ;"
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"
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 ;