[plt-scheme] sending smtp tls mail

From: Stephen De Gabrielle (stephen at degabrielle.name)
Date: Tue Nov 13 19:31:59 EST 2007

Thanks Matt - I wish I could erase that :)

I'm still lost with '(ports->ssl-ports'

which fails with;
	. port->ssl-ports: connect failed (error:1408F10B:SSL
routines:SSL3_GET_RECORD:wrong version number)

cheers
s.

 --


(require (lib "smtp.ss" "net")
         (lib "dns.ss" "net")
         (lib "mzssl.ss" "openssl")
         (lib "url.ss" "net")
         (lib "head.ss" "net")
         )

(smtp-send-message
 (dns-get-address (dns-find-nameserver) "smtp.gmail.com") ; server-string
 "spdegabrielle at gmail.com" ; from-string
 '("spdegabrielle at gmail.com") ; to-list-of-strings
 (insert-field "From" "spdegabrielle at gmail.com" (insert-field "to"
"spdegabrielle at gmail.com" empty-header)) ;; header
 '("test") ;; message-list-of-strings/bytes
 #:port-no 587
 #:auth-user "spdegabrielle at gmail.com"
 #:auth-passwd "xxxxxxxx"
 ; #:tcp-connect proc
 #:tls-encode
 (ports->ssl-ports
  (open-input-string "hello world") ;input-port
  (current-output-port) ;output-port
                  #:mode 'connect
                  ; [#:context context]
                   #:encrypt 'tls
                   #:close-original? #t
                   ;[#:shutdown-on-close? shutdown?]
                   ;[#:error/ssl error]
                   )
 ; [port-no]
 ) ; -> void


Posted on the users mailing list.