On Tue Jun 29, 2010 at 12:13:07 +0100, qpsmtpdfrose.20.ftu...@spamgourmet.com 
wrote:

> I will be writing a plugin that, for a given recipient, parses the
> email body and sends out an email to other recipients.

> So, is there a similar plugin about that does similar that I can look
> at and an rob code from please?

  Real programs don't rob code, they become "inspired" ;)

  I'm not personally familiar with any such existing plugin, but
 you can search the wiki for many non-core plugins:

        http://wiki.qpsmtpd.org/plugins

  You should find that you can easily gain access to the body
 of the message in the data_hook method - from there you'll
 obviously need to parse out the body and just invoke
 /usr/sbin/sendmail, or some other Perl module, to send out
 new mails.

  e.g. Heres a wee bit of code to get the body into a temporary
 file which you can read, and parse:

sub hook_data_post
{
    my ( $self, $transaction ) = @_;

    my $filename = $transaction->body_filename;
    unless ( defined $filename )
    {
        $self->log( LOGWARN, "didn't get a filename" );
        return DECLINED;
    }

    # TODO - parse the contents of that filename, and re-send
    #        out mails.

    return DECLINED;
}


  It shouldn't be too difficult to do what you want, but you're
 welcome to ask questions if you get stuck.

Steve
--
Let me steal your soul?
http://stolen-souls.com

Reply via email to