RFC2595 describe how TLS support can be added to SMTP. The following patch implement this in Emacs' smtpmail.el. It was developed for Emacs 21 but should apply to Emacs 20 too.
How to use:
(setq message-send-mail-function 'smtpmail-send-it ;; for gnus/message send-mail-function 'smtpmail-send-it) ;; for `mail'
(setq smtpmail-smtp-service 25 smtpmail-debug-info t smtpmail-smtp-server "smtp.wherever.com")
M-x customize-variable RET smtpmail-starttls-credentials
RET
and add the server name, server port, and filenames
pointing to files containing keys and certificate.
*trace of SMTP session to smtp.wherever.com*
buffer for details.
The patch.
Emacs 21 users: Do not use the patch, just fetch the latest smtpmail.el version from Emacs CVS instead. It is much more complete.
XEmacs users: Just get the latest "mail-lib" package.
Credits: This patch was developed against the test.smtp.org, thanks to Gregory Neil Shapiro.