[ic] [email ..... with attach

roland interchange-users@interchange.redhat.com
Fri Apr 19 09:01:02 2002


Now I try...
thanks a lot
Roland
----- Original Message -----
From: "Stefan Hornburg (Racke)" <racke@linuxia.de>
To: <interchange-users@interchange.redhat.com>
Sent: Friday, April 19, 2002 1:58 PM
Subject: Re: [ic] [email ..... with attach


> "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)
> _______________________________________________
> interchange-users mailing list
> interchange-users@interchange.redhat.com
> http://interchange.redhat.com/mailman/listinfo/interchange-users