GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Qpsmtpd::Command(3) User Contributed Perl Documentation Qpsmtpd::Command(3)

Qpsmtpd::Command - parse arguments to SMTP commands

Qpsmtpd::Command provides just one public sub routine: parse() .

This sub expects two or three arguments. The first is the name of the SMTP command (such as HELO, MAIL, ...). The second must be the remaining of the line the client sent.

If no third argument is given (or it's not a reference to a CODE) it parses the line according to RFC 1869 (SMTP Service Extensions) for the MAIL and RCPT commands and splitting by spaces (" ") for all other.

Any module can supply it's own parsing routine by returning a sub routine reference from a hook_*_parse. This sub will be called with $self, $cmd and $line .

On successfull parsing it MUST return OK (the constant from Qpsmtpd::Constants) success as first argument and a list of values, which will be the arguments to the hook for this command.

If parsing failed, the second returned value (if any) will be returned to the client as error message.

Inside a plugin

 sub hook_unrecognized_command_parse {
    my ($self, $transaction, $cmd) = @_;
    return (OK, \&bdat_parser) if ($cmd eq 'bdat');
 }

 sub bdat_parser {
    my ($self,$cmd,$line) = @_;
    # .. do something with $line...
    return (DENY, "Invalid arguments") 
      if $some_reason_why_there_is_a_syntax_error;
    return (OK, @args);
 }

 sub hook_unrecognized_command {
    my ($self, $transaction, $cmd, @args) = @_;
    return (DECLINED) if ($self->qp->connection->hello eq 'helo');
    return (DECLINED) unless ($cmd eq 'bdat');
    ....
 }
2013-12-17 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.