SMS coding complete, beginning testing.
Added getInboxAddresses method to User.pm, with tests. All SMS/Email address choices are made in Mail/Send, on create and on send, since that's when it handles groups. Test variable addresses on creating mails. Updated t/smtpd.pl to handle receiving and sending multiple messages.
This commit is contained in:
parent
bc3b204d9b
commit
7336d2d630
6 changed files with 174 additions and 51 deletions
14
t/smtpd.pl
14
t/smtpd.pl
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
my $HOST = shift;
|
||||
my $PORT = shift;
|
||||
my $EMAILS = shift || 1;
|
||||
|
||||
die "HOST must be first argument"
|
||||
unless $HOST;
|
||||
|
|
@ -13,17 +14,26 @@ use Net::SMTP::Server::Client;
|
|||
|
||||
my $server = Net::SMTP::Server->new( $HOST, $PORT );
|
||||
|
||||
while ( my $conn = $server->accept ) {
|
||||
my $counter = 0;
|
||||
|
||||
$| = 1;
|
||||
|
||||
CONNECTION: while ( my $conn = $server->accept ) {
|
||||
my $client = Net::SMTP::Server::Client->new( $conn );
|
||||
$client->process;
|
||||
print to_json({
|
||||
to => $client->{TO},
|
||||
from => $client->{FROM},
|
||||
contents => $client->{MSG},
|
||||
counter => $counter,
|
||||
emails => $EMAILS,
|
||||
});
|
||||
exit(0);
|
||||
print "\n";
|
||||
last CONNECTION if ++$counter >= $EMAILS;
|
||||
}
|
||||
|
||||
sleep 3;
|
||||
exit(0);
|
||||
|
||||
=head1 NAME
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue