richter     00/01/06 03:02:19

  Modified:    .        Changes.pod Embperl.pm EmbperlObject.pm MANIFEST
                        README
               Embperl  Module.pm
               emacs    embperl.el
  Added:       Embperl  Mail.pm
  Log:
     - added new module HTML::Embperl::Mail which sends a file processed via
       Embperl by email.
  
  Revision  Changes    Path
  1.99      +2 -0      embperl/Changes.pod
  
  Index: Changes.pod
  ===================================================================
  RCS file: /home/cvs/embperl/Changes.pod,v
  retrieving revision 1.98
  retrieving revision 1.99
  diff -u -r1.98 -r1.99
  --- Changes.pod       2000/01/06 08:32:58     1.98
  +++ Changes.pod       2000/01/06 11:02:17     1.99
  @@ -12,6 +12,8 @@
      - added EMBPERL_PATH (and path parameter to Execute), which can contain
        a colon separated search path. Embperl uses it when a file, which does
        not contain a path, is executed.
  +   - added new module HTML::Embperl::Mail which sends a file processed via
  +     Embperl by email.
      
   
   =head1 1.2.1  5. Jan 2000
  
  
  
  1.78      +3 -2      embperl/Embperl.pm
  
  Index: Embperl.pm
  ===================================================================
  RCS file: /home/cvs/embperl/Embperl.pm,v
  retrieving revision 1.77
  retrieving revision 1.78
  diff -u -r1.77 -r1.78
  --- Embperl.pm        2000/01/06 08:32:59     1.77
  +++ Embperl.pm        2000/01/06 11:02:17     1.78
  @@ -1,15 +1,16 @@
   
   ###################################################################################
   #
  -#   Embperl - Copyright (c) 1997-1999 Gerald Richter / ECOS
  +#   Embperl - Copyright (c) 1997-2000 Gerald Richter / ECOS
   #
   #   You may distribute under the terms of either the GNU General Public
   #   License or the Artistic License, as specified in the Perl README file.
  -#   For use with Apache httpd and mod_perl, see also Apache copyright.
   #
   #   THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
   #   IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
   #   WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  +#
  +#   $Id: Embperl.pm,v 1.78 2000/01/06 11:02:17 richter Exp $
   #
   ###################################################################################
   
  
  
  
  1.2       +3 -2      embperl/EmbperlObject.pm
  
  Index: EmbperlObject.pm
  ===================================================================
  RCS file: /home/cvs/embperl/EmbperlObject.pm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- EmbperlObject.pm  2000/01/06 08:34:02     1.1
  +++ EmbperlObject.pm  2000/01/06 11:02:17     1.2
  @@ -1,15 +1,16 @@
   
   ###################################################################################
   #
  -#   Embperl - Copyright (c) 1997-1999 Gerald Richter / ECOS
  +#   Embperl - Copyright (c) 1997-2000 Gerald Richter / ECOS
   #
   #   You may distribute under the terms of either the GNU General Public
   #   License or the Artistic License, as specified in the Perl README file.
  -#   For use with Apache httpd and mod_perl, see also Apache copyright.
   #
   #   THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
   #   IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
   #   WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  +#
  +#   $Id: EmbperlObject.pm,v 1.2 2000/01/06 11:02:17 richter Exp $
   #
   ###################################################################################
   
  
  
  
  1.35      +1 -0      embperl/MANIFEST
  
  Index: MANIFEST
  ===================================================================
  RCS file: /home/cvs/embperl/MANIFEST,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- MANIFEST  2000/01/06 08:32:59     1.34
  +++ MANIFEST  2000/01/06 11:02:17     1.35
  @@ -204,5 +204,6 @@
   test/conf/null
   Embperl/Module.pm
   Embperl/Session.pm
  +Embperl/Mail.pm
   emacs/README
   emacs/embperl.el
  
  
  
  1.13      +2 -0      embperl/README
  
  Index: README
  ===================================================================
  RCS file: /home/cvs/embperl/README,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- README    2000/01/05 07:27:27     1.12
  +++ README    2000/01/06 11:02:17     1.13
  @@ -39,6 +39,8 @@
   Introduction to Embperl:    perldoc Intro.pod
   Installation of Embperl:    perldoc INSTALL.pod
   Full documentation:         perldoc Embperl.pod
  +                            perldoc EmbperlObject.pm
  +                            perldoc Embperl/Mail.pm
   Frequent Asked Questions:   perldoc Faq.pod
   Changes:                    perldoc Changes.pod
   Examples:                eg/x/README
  
  
  
  1.2       +34 -0     embperl/Embperl/Module.pm
  
  Index: Module.pm
  ===================================================================
  RCS file: /home/cvs/embperl/Embperl/Module.pm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Module.pm 1999/11/02 08:33:23     1.1
  +++ Module.pm 2000/01/06 11:02:18     1.2
  @@ -1,7 +1,41 @@
  +###################################################################################
  +#
  +#   Embperl - Copyright (c) 1997-2000 Gerald Richter / ECOS
  +#
  +#   You may distribute under the terms of either the GNU General Public
  +#   License or the Artistic License, as specified in the Perl README file.
  +#
  +#   THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
  +#   IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  +#   WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  +#
  +#   $Id: Module.pm,v 1.2 2000/01/06 11:02:18 richter Exp $
  +#
  +###################################################################################
   
  +
  +###################################################################################
  +#
  +#   Embperl - Copyright (c) 1997-2000 Gerald Richter / ECOS
  +#
  +#   You may distribute under the terms of either the GNU General Public
  +#   License or the Artistic License, as specified in the Perl README file.
  +#
  +#   THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
  +#   IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  +#   WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  +#
  +#   $Id: Module.pm,v 1.2 2000/01/06 11:02:18 richter Exp $
  +#
  +###################################################################################
  +
  +
   package HTML::Embperl::Module ;
   
   use HTML::Embperl ;
  +
  +
  +$VERSION = '0.01_dev-1';
   
   
   # define subs
  
  
  
  1.1                  embperl/Embperl/Mail.pm
  
  Index: Mail.pm
  ===================================================================
  ###################################################################################
  #
  #   Embperl - Copyright (c) 1997-2000 Gerald Richter / ECOS
  #
  #   You may distribute under the terms of either the GNU General Public
  #   License or the Artistic License, as specified in the Perl README file.
  #
  #   THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
  #   IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  #   WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  #
  #   $Id: Mail.pm,v 1.1 2000/01/06 11:02:18 richter Exp $
  #
  ###################################################################################
  
  
  package HTML::Embperl::Mail ;
  
  
  require HTML::Embperl ;
  
  use Apache::Constants qw(&OPT_EXECCGI &DECLINED &OK &FORBIDDEN &NOT_FOUND) ;
  
  
  use strict ;
  use vars qw(
      @ISA
      $VERSION
      ) ;
  
  
  @ISA = qw(HTML::Embperl);
  
  
  $VERSION = '0.01_dev-1';
  
  
  
  sub Execute
  
      {
      my ($req) = @_ ;
  
      my $data ;
      my @errors ;
  
      $req -> {options} ||= &HTML::Embperl::optDisableHtmlScan | 
&HTML::Embperl::optRawInput | 
                            &HTML::Embperl::optKeepSpaces      | 
&HTML::Embperl::optReturnError;
      
      $req -> {output}   = \$data ;
      $req -> {errors} ||= \@errors ;
  
      HTML::Embperl::Execute ($req) ;
  
      die "@errors" if (@errors) ;
  
      eval
          {
          require Net::SMTP ;
          
          $req -> {mailhost} ||= $ENV{'EMBPERL_MAILHOST'} || 'localhost' ;
  
          my $smtp = Net::SMTP->new($req -> {mailhost},
                                    Debug => $req -> {maildebug} || 
$ENV{'EMBPERL_MAILDEBUG'}) or die "Cannot connect to mailhost $req->{mailhost}" ;
          $smtp->mail($req -> {from} || $ENV{'EMBPERL_MAILFROM'} || 
"WWW-Server\@$ENV{SERVER_NAME}");
  
          my $to ;
          if (ref ($req -> {'to'}))
              {
              $to = $req -> {'to'} ;
              }
          else
              {
              $to = [] ;
              @$to = split (/\s*;\s*/, $req -> {'to'}) ;
              }
  
          $smtp -> to (@$to) ;
  
          $smtp->data() or die "smtp data failed" ;
          $smtp->datasend("Reply-To: $req->{'reply-to'}\n") or die "smtp data failed"  
if ($req->{'reply-to'}) ;
          $smtp->datasend("To: @$to\n")  or die "smtp datasend failed" ;
          $smtp->datasend("Subject: $req->{subject}\n") or die "smtp datasend failed" ;
          $smtp->datasend("\n")  or die "smtp datasend failed" ;
          $smtp->datasend($data)  or die "smtp datasend failed" ;
          $smtp->quit or die "smtp quit failed" ; 
          } ;
  
      if ($@)
          {
          die "$@" if (ref ($req -> {errors}) eq \@errors) ;
  
          push @{$req -> {errors}}, $@ ;
          }
  
      return ref ($req -> {errors})?@{$req -> {errors}}:0 ;
      }    
  
  
  __END__
  
  =head1 NAME
  
  HTML::EmbperlObject - Extents HTML::Embperl for building webpages out of small 
objects
  
  
  =head1 SYNOPSIS
  
  
   use HTML::Embperl::Mail ;
      
   HTML::Embperl::Mail::Execute ({inputfile => 'template.epl',
                                  subject   => 'Test HTML::Embperl::Mail::Execute',
                                  to        => '[EMAIL PROTECTED]'}) ;
  
  
  =head1 DESCRIPTION
  
  I<HTML::Embperl::Mail> uses I<HTML::Embperl> to process a page template and send
  the result out via EMail. Currently only plain test mails are supported. A later 
  version may add support for HTML mails. Because of that fact, normal I<Embperl>
  HTML processing is disabled per Default (see L<options> below).
  
  =head2 Execute
  
  The C<Execute> function can handle all the parameter that C<HTML::Embperl::Execute>
  does. Addtionaly the following parameters are recognized:
  
  =over 4
  
  =item from
  
  gives the sender e-mail address
  
  =item to
  
  gives the recipient address(es). Multiply addresses can either be separated by 
semikolon
  or given as an array ref.
  
  =item subject
  
  gives the subject line
  
  =item reply-to
  
  the given address is insert as reply address
  
  =item mailhost
  
  Specifies which host to use as SMTP server.
  Default is B<localhost>.
  
  =item maildebug
  
  Set to 1 to enable debugging of mail transfer.
  
  =item options
  
  If no C<options> are given the following are used per default: 
  C<optDisableHtmlScan>, C<optRawInput>, C<optKeepSpaces>, C<optReturnError>
  
  =item errors
  
  As in C<HTML::Embperl::Execute> you can specify an array ref, which returns
  all the error messages from template processing. If you don't specify 
  this parameter C<Execute> will die when an error occurs.
  
  =back
  
  =head2 Configuration
  
  Some default values could be setup via environement variables
  
  
  =head2 EMBPERL_MAILHOST
  
  Specifies which host to use as SMTP server.
  Default is B<localhost>.
  
  =head2 EMBPERL_MAILFROM 
  
  Specifies which the email address that is used as sender.
  Default is B<www-server@server_name>.
  
  =head2 EMBPERL_MAILDEBUG 
  
  Debug setting for Net::SMTP. Default is 0.
  
  =head1 Author
  
  G. Richter ([EMAIL PROTECTED])
  
  =head1 See Also
  
  perl(1), HTML::Embperl, Net::SMTP
  
  
  
  1.70      +0 -0      embperl/emacs/embperl.el
  
  Index: embperl.el
  ===================================================================
  RCS file: /home/cvs/embperl/emacs/embperl.el,v
  retrieving revision 1.69
  retrieving revision 1.70
  diff -u -r1.69 -r1.70
  --- embperl.el        2000/01/06 08:33:00     1.69
  +++ embperl.el        2000/01/06 11:02:18     1.70
  @@ -19,9 +19,9 @@
   ;; Author          : Erik Arneson ([EMAIL PROTECTED])
   ;; Created On      : Wed Jul 22 17:16:39 PDT 1998
   ;; Last Modified By: Erik Arneson
  -;; Last Modified On: $Date: 2000/01/06 08:33:00 $
  +;; Last Modified On: $Date: 2000/01/06 11:02:18 $
   ;; Version         : 1.00
  -;; $Id: embperl.el,v 1.69 2000/01/06 08:33:00 richter Exp $
  +;; $Id: embperl.el,v 1.70 2000/01/06 11:02:18 richter Exp $
   ;;
   ;; Please note that this software is very beta and rather broken.  I
   ;; don't know how useful it will be, although I definitely plan on
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to