File: server_mail.t

package info (click to toggle)
libapache-asp-perl 2.62-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 4,108 kB
  • ctags: 830
  • sloc: perl: 6,033; php: 417; sh: 65; lisp: 22; makefile: 10
file content (43 lines) | stat: -rw-r--r-- 1,048 bytes parent folder | download | duplicates (7)
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
use Apache::ASP::CGI;

&Apache::ASP::CGI::do_self(NoState => 1, 
			   Debug => 3, 
			   # defaults to localhost for mail relay
			   # but will lookup in Net::Config too for
			   # other hosts
			   MailHost => '127.0.0.1',
			   );

__END__

<% use lib '.';	use T;	$t =T->new(); %>
<% 

# test for Net::SMTP, and skip if not installed
eval "use Net::SMTP";
if($@) {
    return;
} else {
    my $smtp = Net::SMTP->new('127.0.0.1');
    unless($smtp) {
	return;
    }
}

$t->eok($Server->Mail({ 
			# won't actually send the mail in test mode
			Test => 1,
			# make the address fairly legit, in case the SMTP
			# is validating in realtime
			To => "asptest\@chamas.com",
			# no from, since some mail gateways may not relay * addresses
			# so we allow for From not to be set while Test is set
			# From => "INSTALL_TEST\@apache-asp.org",
			Subject => "Test Email",
			Body => "Test Body",
			Debug => 0
			}),
	"\$Server->Mail() failed in test mode, check that your mail server at 127.0.0.1 can relay email. "
	);
%>									
<% $t->done; %>