Debian Codegraph @

Embperl/Syntax/Mail.pm

raw
1
2 ###################################################################################
3 #
4 # Embperl - Copyright (c) 1997-2008 Gerald Richter / ecos gmbh www.ecos.de
5 # Embperl - Copyright (c) 2008-2014 Gerald Richter
6 #
7 # You may distribute under the terms of either the GNU General Public
8 # License or the Artistic License, as specified in the Perl README file.
9 #
10 # THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
11 # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
12 # WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13 #
14 # $Id: Mail.pm 1578075 2014-03-16 14:01:14Z richter $
15 #
16 ###################################################################################
17
18 package Embperl::Syntax::Mail ;
19
20 use Embperl::Syntax qw{:types} ;
21 use Embperl::Syntax::HTML ;
22
23 use strict ;
24 use vars qw{@ISA} ;
25
26 @ISA = qw(Embperl::Syntax::HTML) ;
27
28
29 ###################################################################################
30 #
31 # Methods
32 #
33 ###################################################################################
34
35 # ---------------------------------------------------------------------------------
36 #
37 # Create new Syntax Object
38 #
39 # ---------------------------------------------------------------------------------
40
41
42 sub new
43
44 {
45 my $class = shift ;
46
47 my $self = Embperl::Syntax::HTML::new ($class) ;
48
49 if (!$self -> {-mailInit})
50 {
51 $self -> {-mailInit} = 1 ;
52 Init ($self) ;
53 }
54
55 return $self ;
56 }
57
58
59
60 ###################################################################################
61 #
62 # Definitions for Mail HTML tags
63 #
64 ###################################################################################
65
66 sub Init
67
68 {
69 my ($self) = @_ ;
70
71 $self -> AddTagBlock ('mail:send', ['from', 'to', 'cc', 'bcc', 'subject', 'reply-to',
72 'mailhost', 'mailhelo', 'maildebug', 'content-type'],
73 undef, undef,
74 {
75 removenode => 106,
76 compiletimeperlcode => q{
77 $_ep_mail_opt_save = $Embperl::req->component->config->options ;
78 $Embperl::req->component->config->options (Embperl::Constant::optKeepSpaces | $_ep_mail_opt_save) ;
79 },
80 compiletimeperlcodeend => q{
81 $Embperl::req->component->config->options ($_ep_mail_opt_save) ;
82 },
83
84 perlcodeend => q{
85 {
86 use Embperl::Mail ;
87
88 my $txt = XML::Embperl::DOM::Node::iChildsText (%$n%) ;
89 my @errors ;
90 $? = Embperl::Mail::Execute (
91 {
92 'input' => \$txt,
93 'inputfile' => 'mail',
94 'errors' => \@errors,
95 'syntax' => 'Text',
96 'from' => %&'from%,
97 'to' => %&'to%,
98 'cc' => %&'cc%,
99 'bcc' => %&'bcc%,
100 'subject' => %&'subject%,
101 'reply-to' => %&'reply-to%,
102 'mailhost' => %&'mailhost%,
103 'mailhelo' => %&'mailhelo%,
104 'maildebug' => %&'maildebug%,
105 'mailheaders' => [ (( %&'content-type% ) ? ('Content-Type: '.%&'content-type%) : ()) ],
106 }) ;
107 print STDERR join ('; ', @errors) if (@errors) ;
108 }
109 },
110 stackname => 'mail_send',
111 'push' => '%$x%',
112 },
113 ) ;
114
115 }
116
117
118 ###################################################################################
119 #
120 # Mail Implementation
121 #
122 ###################################################################################
123
124
125 1;
126
127 __END__
128
129 =pod
130
131 =head1 NAME
132
133 Embperl::Syntax::Mail - tag library for sending mail
134
135 =head1 SYNOPSIS
136
137 [$ syntax + Mail $]
138
139 <mail:send to="[email protected]" subject="Testmail">
140 Hi,
141 this is a test for a new mail tag
142 it is send at [+ scalar(localtime) +]
143 from Embperl's Mail taglib.
144 </mail:send>
145
146 [$ if $? $]
147 <h2>Sorry, there was an error, your mail couldn't be send</h2>
148 [$else$]
149 <h2>Your mail was successfully delivered</h2>
150 [$endif$]
151
152
153 =head1 DESCRIPTION
154
155 The is module provides a mail:send tag, for sending text via email. It uses the
156 Embperl::Mail module for actualy sending the mail. The following attributes
157 are recognized. The mail body is enclosed between the mail:send tags.
158 See L<Embperl::Mail> for an description of the attribues:
159
160
161 =over 4
162
163 =item from
164
165 =item to
166
167 =item cc
168
169 =item bcc
170
171 =item subject
172
173 =item reply-to
174
175 =item mailhost
176
177 =item mailhelo
178
179 =item maildebug
180
181 =item content-type
182
183 =back
184
185
186 On success it sets C<$?> to zero, otherwise to a value other then zero.
187
188 =head1 Author
189
190 Gerald Richter <richter at embperl dot org>
191
192 =head1 See Also
193
194 Embperl::Syntax, Embperl::Syntax::HTML
195