Posted to tcl by nscerqueira at Wed Feb 18 19:00:35 GMT 2015view pretty

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

    set token [mime::initialize -canonical application/x-csv -file $file \
        -header [list Content-Disposition "attachment; filename=\"[file tail $file]\""]]
    
  
    
    # create plain text attachment also
    
          mime::setheader $token Subject $subject
          smtp::sendmessage $token \
                    -ports 587 \
                    -debug 1\
                    -username XXXX \
                    -password XXXX \
                    -recipients $recipient -servers $email_server
          mime::finalize $token
}


set file "/Users/nunocerqueira/lixo/job.gz"

send_simple_message XXXX smtp.gmail.com \
    "This is the subject." "This is the message!" $file