~ubuntu-branches/ubuntu/trusty/tclcurl/trusty

« back to all changes in this revision

Viewing changes to tests/smtp.tcl

  • Committer: Package Import Robot
  • Author(s): Sven Hoexter
  • Date: 2012-06-02 20:48:44 UTC
  • mfrom: (1.2.9) (4.1.6 sid)
  • Revision ID: package-import@ubuntu.com-20120602204844-vi72mu1if5trqssn
Tags: 7.22.0-1
* New upstream release
  + Remove debian/patches/deprecated-curl-types - fixed upstream.
  + Build-depend on libcurl4-gnutls-dev (>= 7.22.0).
  + Refresh all patches.
* Remove overrides for dh_clean and dh_installexamples. All the
  build artefacts which required special handling are no longer
  included in the upstream tarball.
* Switch to dh compat level 9, build-depend on debhelper (>= 9).
* Switch LDFLAGS to DEB_LDFLAGS_MAINT_PREPEND.
* Change Standards-Version to 3.9.3 - no changes required.
* Update copyright year and download location in debian/copyright.
* Update homepage in debian/watch and debian/control.
* Continue to move the libs to /usr/lib/tcltk/ for now against
  the will of the buildsystem. Original installation path is
  now architecture dependend.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package require TclCurl
 
2
 
 
3
# As an example this is contrived, but it works.
 
4
 
 
5
set alreadySent 0
 
6
set mailToSend \
 
7
"Date: Mon, 12 Sep 2011 20:34:29 +0200
 
8
To: fandom@telefonica.net
 
9
From: andres@verot.com
 
10
Subject: SMTP example
 
11
 
 
12
The body of the message starts here.
 
13
 
 
14
It could be a lot of lines, could be MIME encoded, whatever.
 
15
Check RFC5322.
 
16
"
 
17
 
 
18
proc sendString {size} {
 
19
    global alreadySent mailToSend
 
20
    
 
21
    set toSend       [string range $mailToSend $alreadySent [incr $alreadySent $size]]
 
22
    
 
23
    incr alreadySent [string length $toSend]
 
24
 
 
25
    return $toSend
 
26
}
 
27
 
 
28
set curlHandle [curl::init]
 
29
 
 
30
$curlHandle configure -url "smtp://smtp.telefonica.net:25"
 
31
 
 
32
$curlHandle configure -username "fandom\$telefonica.net"
 
33
$curlHandle configure -password "XXXXXXXX"
 
34
 
 
35
$curlHandle configure -mailfrom "fandom@telefonica.net"
 
36
$curlHandle configure -mailrcpt [list "fandom@telefonica.net" "andresgarci@telefonica.net"]
 
37
 
 
38
# You could put the mail in a file and use the '-infile' option
 
39
$curlHandle configure -readproc sendString
 
40
 
 
41
$curlHandle configure -verbose 1
 
42
 
 
43
$curlHandle perform
 
44
 
 
45
$curlHandle cleanup
 
46
 
 
47
 
 
48
 
 
49
 
 
50
 
 
51
 
 
52