Welcome, guest | Sign In | My Account | Store | Cart

sendmail_proc - a procedure for sending mail using smtp.

Tcl, 26 lines
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
proc sendSimpleMessage {email_address subject body} {

    puts "\n*** sendSimpleMessage proc ***\n"

    package require smtp
    package require mime

    set emailServer your.email.server

    puts "\nemail address: $email_address"
    puts "subject:       $subject"
    puts "body:          $body"
    puts "email_server:  $emailServer\n"

    set computer_name $::env(COMPUTERNAME)

    set message [mime::initialize -canonical text/plain -file $body]
    
    smtp::sendmessage $message -servers $emailServer \
		               -header [list To $email_address] \
		               -header [list From $computer_name] \
		               -header [list Subject $subject]

    mime::finalize $message
    
}
Created by Patrick Finnegan on Sun, 23 Jan 2005 (MIT)
Tcl recipes (162)
Patrick Finnegan's recipes (56)

Required Modules

  • (none specified)

Other Information and Tasks