Skip Menu |

This queue is for tickets about the AnyEvent-SMTP CPAN distribution.

Report information
The Basics
Id: 66580
Status: resolved
Priority: 0/
Queue: AnyEvent-SMTP

People
Owner: MONS [...] cpan.org
Requestors: dynot [...] JUNKMAIL.ATH.CX
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.06
Fixed in: (no value)



Subject: recipient validation
I would like to validate recipients during the smtp transaction. I was able to accomplish this by editing the new subroutine in Server.pm: RCPT => sub { my ($s,$con,@args) = @_; my $to = join ' ',@args; $to =~ s{^to:}{}i or $con->reply('501 Usage: RCPT TO:<mail addr>'); $con->{m}{from} or return $con->reply("503 Error: need MAIL command"); my @addrs = map { $_->address } Mail::Address->parse ($to); @addrs or $con->reply('501 Usage: RCPT TO:<mail Show quoted text
addr>');
#everything is unchanged until this point ######### validate rcpt ##### my $domain; if ($addrs[0] =~ /@(.*)\s*$/) { $domain = $1; } if (not(grep $domain eq $_, @local_domains)) { warn "$addrs[0]: Recipient address rejected: Relay access denied"; return $con->reply("554 Error: $addrs[0]: Recipient address rejected: Relay access denied"); } ######### validate rcpt ##### push @{ $con->{m}{to} ||= [] }, $addrs[0]; $con->ok; }, It would be great if the user could write a validation function without editing module files, like in the Net::Server::Mail::SMTP module http://search.cpan.org/~guimard/Net-Server-Mail-0.17/lib/Net/Server/Mail/ SMTP.pm
Added simple validation methods in 0.07 But you also could handle events RCPT and MAIL to override default behaviour