MOCK > Apache-SMTP > Apache::SMTP

Download:
Apache-SMTP-0.01.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.01   Source  

NAME ^

Apache::SMTP - A simple SMTP server using Apache and mod_perl made simple with Apache::TieBucketBrigade

SYNOPSIS ^

Listen 127.0.0.1:25 <VirtualHost _default_:25> PerlSetVar MailHost some.smtp.server PerlSetVar MailPort 25 PerlModule Apache::SMTP PerlProcessConnectionHandler Apache::SMTP </VirtualHost>

DESCRIPTION ^

This implements a very simple SMTP server using Apache and mod_perl 2. The current behavior is to immediately send (using Net::SMTP) any mail it receives to the server set using PerlSetVar MailHost on port PerlSetVar MailPort

Because of the above behavior, this module _may_ act as an ***OPEN RELAY*** which is a bad thing. So please do not configure it as such. Instead, subclass this module and write your own validate_sender() and validate_recipient() methods. Alternatively, do not have your mail server allow relaying from this server's ip, and you should be ok.

Also, this module, despite the methods "add_queue" and "queue_message" does not actually implement a queue in the normal MTA sense of the word. Maybe you would like to implement one?

SUBCLASS

You may want to subclass this module and write your own version of the following

validate_hostname

    sub validate_hostname {
        my ($session, $hostname) = @_;
        return(1, 250, "ok");
    }

validate_sender

    sub validate_sender {
        my ($session, $sender) = @_;
        return(1, 250, "ok");
    }

validate_recipient

    sub validate_recipient {
        my ($session, $recipient) = @_;
        return(1, 250, "ok");
    }

queue_message

    sub queue_message {
        my($session, $data) = @_;
        my $msgid = add_queue({mailhost => 'hostname',
                           mailport => '25',
                           mailip => '127.0.0.1',
                           sender => 'foo@example.com',
                           recipients => \('bar@example.com'),
                           data => $$data});
        return(1, 250, "message queued $msgid");
    }

add_queue

    my $msgid = add_queue({mailhost => 'hostname',
                           mailport => '25',          
                           mailip => '127.0.0.1',
                           sender => 'foo@example.com',
                           recipients => \('bar@example.com'),
                           data => 'somestuff'});      

SEE ALSO ^

Apache::SMTP::Server Apache::TieBucketBrigade Net::Server::Mail::SMTP Net::SMTP mod_perl 2

AUTHOR ^

mock, <mock@obscurity.org>

COPYRIGHT AND LICENSE ^

Copyright (C) 2004 by Will Whittaker and Ken Simpson

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.2 or, at your option, any later version of Perl 5 you may have available.

syntax highlighting: