| 1 | |||
| 2 | ################################################################################### | ||
| 3 | # | ||
| 4 | # Embperl - Copyright (c) 1997-2008 Gerald Richter / ecos gmbh www.ecos.de | ||
| 5 | # Embperl - Copyright (c) 2008-2015 Gerald Richter | ||
| 6 | # Embperl - Copyright (c) 2015-2023 actevy.io | ||
| 7 | # | ||
| 8 | # You may distribute under the terms of either the GNU General Public | ||
| 9 | # License or the Artistic License, as specified in the Perl README file. | ||
| 10 | # | ||
| 11 | # THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR | ||
| 12 | # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED | ||
| 13 | # WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
| 14 | # | ||
| 15 | ################################################################################### | ||
| 16 | |||
| 17 | package Embperl::Syntax::Mail ; | ||
| 18 | |||
| 19 | use Embperl::Syntax qw{:types} ; | ||
| 20 | use Embperl::Syntax::HTML ; | ||
| 21 | |||
| 22 | use strict ; | ||
| 23 | use vars qw{@ISA} ; | ||
| 24 | |||
| 25 | @ISA = qw(Embperl::Syntax::HTML) ; | ||
| 26 | |||
| 27 | |||
| 28 | ################################################################################### | ||
| 29 | # | ||
| 30 | # Methods | ||
| 31 | # | ||
| 32 | ################################################################################### | ||
| 33 | |||
| 34 | # --------------------------------------------------------------------------------- | ||
| 35 | # | ||
| 36 | # Create new Syntax Object | ||
| 37 | # | ||
| 38 | # --------------------------------------------------------------------------------- | ||
| 39 | |||
| 40 | |||
| 41 | sub new | ||
| 42 | |||
| 43 | { | ||
| 44 | my $class = shift ; | ||
| 45 | |||
| 46 | my $self = Embperl::Syntax::HTML::new ($class) ; | ||
| 47 | |||
| 48 | if (!$self -> {-mailInit}) | ||
| 49 | { | ||
| 50 | $self -> {-mailInit} = 1 ; | ||
| 51 | Init ($self) ; | ||
| 52 | } | ||
| 53 | |||
| 54 | return $self ; | ||
| 55 | } | ||
| 56 | |||
| 57 | |||
| 58 | |||
| 59 | ################################################################################### | ||
| 60 | # | ||
| 61 | # Definitions for Mail HTML tags | ||
| 62 | # | ||
| 63 | ################################################################################### | ||
| 64 | |||
| 65 | sub Init | ||
| 66 | |||
| 67 | { | ||
| 68 | my ($self) = @_ ; | ||
| 69 | |||
| 70 | $self -> AddTagBlock ('mail:send', ['from', 'to', 'cc', 'bcc', 'subject', 'reply-to', | ||
| 71 | 'mailhost', 'mailhelo', 'maildebug', 'content-type'], | ||
| 72 | undef, undef, | ||
| 73 | { | ||
| 74 | removenode => 106, | ||
| 75 | compiletimeperlcode => q{ | ||
| 76 | $_ep_mail_opt_save = $Embperl::req->component->config->options ; | ||
| 77 | $Embperl::req->component->config->options (Embperl::Constant::optKeepSpaces | $_ep_mail_opt_save) ; | ||
| 78 | }, | ||
| 79 | compiletimeperlcodeend => q{ | ||
| 80 | $Embperl::req->component->config->options ($_ep_mail_opt_save) ; | ||
| 81 | }, | ||
| 82 | |||
| 83 | perlcodeend => q{ | ||
| 84 | { | ||
| 85 | use Embperl::Mail ; | ||
| 86 | |||
| 87 | my $txt = XML::Embperl::DOM::Node::iChildsText (%$n%) ; | ||
| 88 | my @errors ; | ||
| 89 | $? = Embperl::Mail::Execute ( | ||
| 90 | { | ||
| 91 | 'input' => \$txt, | ||
| 92 | 'inputfile' => 'mail', | ||
| 93 | 'errors' => \@errors, | ||
| 94 | 'syntax' => 'Text', | ||
| 95 | 'from' => %&'from%, | ||
| 96 | 'to' => %&'to%, | ||
| 97 | 'cc' => %&'cc%, | ||
| 98 | 'bcc' => %&'bcc%, | ||
| 99 | 'subject' => %&'subject%, | ||
| 100 | 'reply-to' => %&'reply-to%, | ||
| 101 | 'mailhost' => %&'mailhost%, | ||
| 102 | 'mailhelo' => %&'mailhelo%, | ||
| 103 | 'maildebug' => %&'maildebug%, | ||
| 104 | 'mailheaders' => [ (( %&'content-type% ) ? ('Content-Type: '.%&'content-type%) : ()) ], | ||
| 105 | }) ; | ||
| 106 | print STDERR join ('; ', @errors) if (@errors) ; | ||
| 107 | } | ||
| 108 | }, | ||
| 109 | stackname => 'mail_send', | ||
| 110 | 'push' => '%$x%', | ||
| 111 | }, | ||
| 112 | ) ; | ||
| 113 | |||
| 114 | } | ||
| 115 | |||
| 116 | |||
| 117 | ################################################################################### | ||
| 118 | # | ||
| 119 | # Mail Implementation | ||
| 120 | # | ||
| 121 | ################################################################################### | ||
| 122 | |||
| 123 | |||
| 124 | 1; | ||
| 125 | |||
| 126 | __END__ |