[jp] Re: mail plugin using mail folder for in and out mails

Bob Apthorpe arclight at jump.net
Thu Mar 6 16:37:43 EST 2003

On Thu, 6 Mar 2003, Ludovic Rousseau wrote:

> Le jeudi 06 mars 2003 à 14:45:59, Carlo Graziani a écrit:
> > So, it seems to me that if you have a reasonably high tolerance for using
> > other peoples' software in ways they probably didn't envision, you can
> > customize $SENDMAIL and $SENDMAILFLAGS in the procmailrc file to invoke the
> > MTA of your choice with your favorite command-line flags.
> Yes. But my problem is to find such a MTA.
> And if I find one I would use it directly and not through procmail.
> sendmail, exim, postfix, qmail, etc. are too complex for what I need. I
> just need a SMTP client, not a SMTP server.
> Maybe I will write it myself in Perl.

You mean, something like:

        #!/usr/bin/perl -w
        use strict;

        use Mail::Internet;
        my %option = ();
        $option{'mailhost'} = 'mailhost.example.com';

        # magically obtain $msgbody and $msgheader

        # Note that Mail::Internet expects $msgbody to be an array of
        # lines. It can be one line with lots of \n's in it; it just needs
        # to be passed in as a reference to a list (hence the []'s)

        my $mail = Mail::Internet->new(
          'Body' => [$msgbody],
          'Header' => $msgheader,

        # send message
        my @recips = ();
        @recips = $mail->smtpsend('Host' => $option{'mailhost'});

        # Add error-checking to verify the mail was sent out;
        # @recips is the list of recipients that the mail was
        # successfully delivered to.

        # add =pod docs here...

This untested fragment was gracelessly ripped from a working script. I
made a few comments and modifications to clarify the logic. Add taint
checking for extra paranoia.


-- Bob

More information about the Jpilot mailing list