1smtp(n)                           smtp client                          smtp(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       smtp - Client-side tcl implementation of the smtp protocol
9

SYNOPSIS

11       package require Tcl
12
13       package require mime  ?1.4.1?
14
15       package require smtp  ?1.4.2?
16
17       ::smtp::sendmessage token option...
18
19_________________________________________________________________
20

DESCRIPTION

22       The  smtp  library  package provides the client side of the Simple Mail
23       Transfer Protocol (SMTP) (1) (2).
24
25       ::smtp::sendmessage token option...
26              This command sends the MIME part (see package mime)  represented
27              by  token  to  an  SMTP server. options is a list of options and
28              their associated values.  The recognized options are:
29
30              -servers
31                     A list of SMTP servers. The default is localhost.
32
33              -ports A list of SMTP ports. The default is 25.
34
35              -queue Indicates that the SMTP server should be asked  to  queue
36                     the message for later processing. A boolean value.
37
38              -atleastone
39                     Indicates  that  the  SMTP  server must find at least one
40                     recipient acceptable for the message to be sent. A  bool‐
41                     ean value.
42
43              -originator
44                     A  string  containing an 822-style address specification.
45                     If present the header isn't examined  for  an  originator
46                     address.
47
48              -recipients
49                     A  string containing one or more 822-style address speci‐
50                     fications. If  present  the  header  isn't  examined  for
51                     recipient  addresses).  If  the string contains more than
52                     one address they will be separated by commas.
53
54              -header
55                     A list of keywords and their values (may  occur  zero  or
56                     more times).
57
58              -usetls
59                     This  package  supports the RFC 3207 TLS extension (3) by
60                     default provided the tls package is  available.  You  can
61                     turn this off with this boolean option.
62
63              -tlspolicy
64                     This option lets you specify a command to be called if an
65                     error occurs during TLS setup. The command is called with
66                     the  SMTP  code and diagnostic message appended. The com‐
67                     mand should return 'secure' or 'insecure' where  insecure
68                     will  cause  the  package  to continue on the unencrypted
69                     channel.  Returning 'secure' will cause the socket to  be
70                     closed  and  the  next  server in the -servers list to be
71                     tried.
72
73              -username
74
75              -password
76                     If your SMTP server  requires  authentication  (RFC  2554
77                     (4))  before  accepting  mail  you  can use -username and
78                     -password to provide your authentication details  to  the
79                     server. Currently this package supports DIGEST-MD5, CRAM-
80                     MD5, LOGIN and PLAIN  authentication  methods.  The  most
81                     secure  method  will be tried first and each method tried
82                     in turn until we are either authorized or we run  out  of
83                     methods.  Note  that  if the server permits a TLS connec‐
84                     tion, then the authorization will occur  after  we  begin
85                     using the secure channel.
86
87       If  the  -originator  option  is not present, the originator address is
88       taken from From (or Resent-From); similarly, if the -recipients  option
89       is  not present, recipient addresses are taken from To, cc, and Bcc (or
90       Resent-To, and so on). Note that the header key/values supplied by  the
91       -header  option  (not  those  present  in the MIME part) are consulted.
92       Regardless, header key/values are added to the outgoing message as nec‐
93       essary to ensure that a valid 822-style message is sent.
94
95       The  command  returns a list indicating which recipients were unaccept‐
96       able to the SMTP server. Each element of the list is another list, con‐
97       taining  the  address,  an  SMTP  error code, and a textual diagnostic.
98       Depending on the -atleastone option and the intended recipients, a non-
99       empty  list  may  still  indicate  that the message was accepted by the
100       server.
101

EXAMPLE

103       proc send_simple_message {recipient email_server subject body} {
104           package require smtp
105           package require mime
106
107           set token [mime::initialize -canonical text/plain \\
108            -string $body]
109           mime::setheader $token Subject $subject
110           smtp::sendmessage $token \\
111            -recipients $recipient -servers $email_server
112           mime::finalize $token
113       }
114
115       send_simple_message someone@somewhere.com localhost \\
116           "This is the subject." "This is the message."
117
118

REFERENCES

120       [1]    Jonathan B. Postel, "SIMPLE MAIL TRANSFER  PROTOCOL",  RFC  821,
121              August 1982.  (http://www.rfc-editor.org/rfc/rfc821.txt)
122
123       [2]    J.  Klensin,  "Simple  Mail  Transfer Protocol", RFC 2821, April
124              2001.  (http://www.rfc-editor.org/rfc/rfc2821.txt)
125
126       [3]    P. Hoffman, "SMTP Service Extension for Secure SMTP over  Trans‐
127              port Layer Security", RFC 3207, February 2002.  (http://www.rfc-
128              editor.org/rfc/rfc3207.txt)
129
130       [4]    J. Myers, "SMTP Service Extension for Authentication", RFC 2554,
131              March 1999.  (http://www.rfc-editor.org/rfc/rfc2554.txt)
132

SEE ALSO

134       ftp, http, mime, pop3
135

KEYWORDS

137       email,  internet,  mail,  mime,  net, rfc 2554, rfc 2821, rfc 3207, rfc
138       821, rfc 822, smtp, tls
139
141       Copyright (c) 1999-2000 Marshall T. Rose
142
143
144
145
146mime                                 1.4.2                             smtp(n)
Impressum