Tcl Library Source Code

Documentation
Login


[ Main Table Of Contents | Table Of Contents | Keyword Index | Categories | Modules | Applications ]

NAME

smtp - Client-side tcl implementation of the smtp protocol

Table Of Contents

SYNOPSIS

package require Tcl
package require mime ?1.5.4?
package require smtp ?1.5?

::smtp::sendmessage token option...

DESCRIPTION

The smtp library package provides the client side of the Simple Mail Transfer Protocol (SMTP) (1) (2).

Authentication

Beware. SMTP authentication uses SASL. I.e. if the user has to authenticate a connection, i.e. use the options -user and -password (see above) it is necessary to have the sasl package available so that smtp can load it.

This is a soft dependency because not everybody requires authentication, and sasl depends on a lot of the cryptographic (secure) hashes, i.e. all of md5, otp, md4, sha1, and ripemd160.

EXAMPLE

proc send_simple_message {recipient email_server subject body} {
    package require smtp
    package require mime

    set token [mime::initialize -canonical text/plain \
	-string $body]
    mime::setheader $token Subject $subject
    smtp::sendmessage $token \
	-recipients $recipient -servers $email_server
    mime::finalize $token
}

send_simple_message someone@somewhere.com localhost \
    "This is the subject." "This is the message."

TLS Security Considerations

This package uses the TLS package to handle the security for https urls and other socket connections.

Policy decisions like the set of protocols to support and what ciphers to use are not the responsibility of TLS, nor of this package itself however. Such decisions are the responsibility of whichever application is using the package, and are likely influenced by the set of servers the application will talk to as well.

For example, in light of the recent POODLE attack discovered by Google many servers will disable support for the SSLv3 protocol. To handle this change the applications using TLS must be patched, and not this package, nor TLS itself. Such a patch may be as simple as generally activating tls1 support, as shown in the example below.

package require tls
tls::init -tls1 1 ;# forcibly activate support for the TLS1 protocol

... your own application code ...

REFERENCES

  1. Jonathan B. Postel, "SIMPLE MAIL TRANSFER PROTOCOL", RFC 821, August 1982. (http://www.rfc-editor.org/rfc/rfc821.txt)

  2. J. Klensin, "Simple Mail Transfer Protocol", RFC 2821, April 2001. (http://www.rfc-editor.org/rfc/rfc2821.txt)

  3. P. Hoffman, "SMTP Service Extension for Secure SMTP over Transport Layer Security", RFC 3207, February 2002. (http://www.rfc-editor.org/rfc/rfc3207.txt)

  4. J. Myers, "SMTP Service Extension for Authentication", RFC 2554, March 1999. (http://www.rfc-editor.org/rfc/rfc2554.txt)

Bugs, Ideas, Feedback

This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category smtp of the Tcllib Trackers. Please also report any ideas for enhancements you may have for either package and/or documentation.

When proposing code changes, please provide unified diffs, i.e the output of diff -u.

Note further that attachments are strongly preferred over inlined patches. Attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar.

SEE ALSO

ftp, http, mime, pop3

KEYWORDS

email, internet, mail, mime, net, rfc 2554, rfc 2821, rfc 3207, rfc 821, rfc 822, smtp, tls

CATEGORY

Networking

COPYRIGHT

Copyright © 1999-2000 Marshall T. Rose and others