ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/host/c++/socket++-1.10/test/tcsmtp.C
Revision: 1.1
Committed: Mon Feb 26 15:02:39 2001 UTC (24 years, 10 months ago) by ab11
Content type: text/plain
Branch: MAIN
CVS Tags: PROJECT_COMPLETION
Log Message:
Test programs for Networking class. Unused by the host

File Contents

# Content
1 #include <smtp.h>
2 #include <stdio.h>
3 #include <pwd.h>
4 #include <unistd.h>
5
6 int main (int ac, char** av)
7 {
8 if (ac < 4) {
9 cerr << "USAGE: " << av [0] << " host recipient files...\n";
10 return 1;
11 }
12
13 smtp client (&cout);
14
15 // establish connection
16 client->connect (av [1]);
17 client->helo ();
18
19 // get help
20 client->help ();
21
22 // get the FROM address
23 char sender [256];
24 passwd* pw = getpwuid( getuid() );
25 sprintf(sender, "%s@%s", pw->pw_name, client->localhost());
26
27 // send the files
28 for (int i = 3; i < ac; i++) {
29 client->mail (sender);
30 client->rcpt (av [2]);
31 client->data (av [i]);
32 client->rset ();
33 }
34
35 // finally quit
36 client->quit ();
37
38 return 0;
39 }