[ic] [email ..... with attach
Stefan Hornburg Racke
interchange-users@interchange.redhat.com
Fri Apr 19 07:59:00 2002
"roland" <twentys@libero.it> writes:
> Hi to everybody.
> I'm trying to send an automatic email with attach.
> I' m using perl code, but something doesn't work.
> Any idea with ictag [email......].....[/email] or perl code?
> Thanks a lot
UserTag email_mime Order to subject reply from extra type path btype
UserTag email_mime hasEndTag
UserTag email_mime Interpolate
UserTag email_mime Routine <<EOR
sub {
require MIME::Lite;
my($to, $subject, $reply, $from, $extra, $type, $path, $btype, $body) = @_;
my($ok, @types, @paths);
my($msg);
$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;
$ok = 0;
$msg = MIME::Lite -> new (From => $from, To => $to, Subject => $subject,
Type => ($btype || 'TEXT'), Data => $body);
if (ref $type eq 'ARRAY') {
@types = @{$type};
} else {
@types = $type;
}
if (ref $path eq 'ARRAY') {
@paths = @{$path};
} else {
@paths = $path;
}
for (my $i = 0; $i < @types; $i++) {
$msg -> attach (Type => $types[$i], Path => $paths[$i]);
}
$ok = $msg -> send;
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");
}
$ok;
}
EOR
Ciao
Racke
--
Think of it !
For projects and other business stuff please refer to COBOLT NetServices
(URL: http://www.cobolt.net; Email: info@cobolt.net; Phone: 0041-1-3884400)