File: email

package info (click to toggle)
smsclient 2.0.8z-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,588 kB
  • ctags: 1,363
  • sloc: ansic: 14,322; makefile: 552; sh: 450; perl: 161
file content (134 lines) | stat: -rw-r--r-- 2,581 bytes parent folder | download | duplicates (4)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# --------------------------------------------------------------------
# Using the GENERIC driver.
# It is possible build simple client interfaces to dialin networks
# for delivering SMS messages.
#
# A Simple generic script consists of three sections:
#
#	login
#	send
#	disconnect
#
#
# Each sections is made up of a list of Actions.
# Where each action is a dictionary consisting of
# a number of entries, these include:
#
#	message 
#	send
#	expect
#	success
#	failure
#
#
# The basic sequence of events is:
#
#	1. If 'message' is present output to console.
#	2. If 'send' is present output to server.
#	3. If 'expect' is present, check the input from
#	   the server against the expect string.
#	4. If the expect string matches output 'success' to console.
#	   proceed to next entry and goto step 1.
#	5. If the expect string does NOT match, output 'failure' to 
#          console. do NOT proceed any further.
#
# --------------------------------------------------------------------
#
# Example.
# The script below sends an email by connecting
# to an SMTP server.
#
# --------------------------------------------------------------------

{
	login = 
	(
		{	message = "Connecting to server...\n"
		},
		{ 
			expect  = "220 "
			success = "Welcome prompt found\n"
			failure = "Welcome Failed - Welcome prompt expected\n"
		},
		{ 
			expect  = "\n"
			success = "Welcome prompt found\n"
			failure = "Welcome Failed - Welcome prompt expected\n"
		}
	)

	send =
	(
		{ 
			send    = "MAIL FROM: bill.gates@microsoft.com\n"
			expect  = "250 "
			success = "Successfully set Mail from\n"
			failure = "failed to set Mail from\n"
		},
		{ 
			expect  = "\n"
			success = ""
			failure = ""
		},
		{ 
			send    =
			(
				"RCPT TO: ",
				'$ID$',
				"\n"
			)

			expect  = "250 "
			success = "Successfully set Mail to\n"
			failure = "failed to set Mail to\n"
		},
		{ 
			expect  = "\n"
			success = ""
			failure = ""
		},
		{ 
			send    = "DATA\n"
			expect  = "354 "
			success = "Successfully initiating data transfer\n"
			failure = "failed initiating data transfer\n"
		},
		{ 
			expect  = "\n"
			success = ""
			failure = ""
		},
		{ 
			send =  
			(	
				'$MSG$',
				"\n",
				".\n"
			)

			expect  = "250 "
			success = "Successfully set data\n"
			failure = "failed to set data\n"
		},
		{ 
			expect  = "\n"
			success = ""
			failure = ""
		}
	)

	disconnect = 
	(
		{ 
			send    = "QUIT\n"
			expect  = "221"
			success = "Disconnect successful\n"
			failure = "Disconnect Failed\n"
		},
		{ 
			expect  = "\n"
			success = ""
			failure = ""
		}
	)
}