/
email.tag
44 lines (38 loc) · 1.27 KB
/
email.tag
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Copyright 2002-2005 Interchange Development Group (http://www.icdevgroup.org/)
# Licensed under the GNU GPL v2. See file LICENSE for details.
# $Id: email.tag,v 1.2 2005-11-08 18:14:44 jon Exp $
UserTag email Order to subject reply from extra
UserTag email hasEndTag
UserTag email addAttr
UserTag email Interpolate
UserTag email Version $Revision: 1.2 $
UserTag email Routine <<EOR
sub {
my ($to, $subject, $reply, $from, $extra, $opt, $body) = @_;
my $ok = 0;
my @extra;
$subject = '<no subject>' unless defined $subject && $subject;
$reply = '' unless defined $reply;
$reply = "Reply-to: $reply\n" if $reply;
if (! $from) {
$from = $Vend::Cfg->{MailOrderTo};
$from =~ s/,.*//;
}
$extra =~ s/\s*$/\n/ if $extra;
$extra .= "From: $from\n" if $from;
@extra = grep /\S/, split(/\n/, $extra);
SEND: {
$ok = send_mail($to, $subject, $body, $reply, 0, @extra);
}
if (!$ok) {
logError("Unable to send mail using $Vend::Cfg->{'SendMailProgram'}\n" .
"To '$to'\n" .
"From '$from'\n" .
"With extra headers '$extra'\n" .
"With reply-to '$reply'\n" .
"With subject '$subject'\n" .
"And body:\n$body");
}
return $opt->{hide} ? '' : $ok;
}
EOR