[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ic] email-raw usertag broken for Net::SMTP FIX


Quoting Peter (suppressed):
> Well technically it's not broken because it does specify in the docs 
> that it uses sendmail.  But if you use Net::SMTP for sending out emails 
> then no emails will be sent via this tag.  I've modified the tag to work 
> with Net::SMTP as well (feel free to tweak and change or whatever) and 
> would like to submit this to be included in future versions of 
> interchange.  Here's a patch to IC 5.2.
> 
> Note that in theory you could eliminate all bbut the middle clause to 
> the if/elsif/else statement, but i wanted to keep the original 
> functionality of being able to send directly to sendmail rather than 
> simulate it through the send_mail function.

This seems like a useful idea. It just so happens that I have just
enhanced the [email ...] tag to do attachments with MIME::Lite,
and haven't yet committed it. It uses [email-raw ..] to send,
so I can put both in at the same time.

> 
> Note the following patch may (probably does) suffer from word-wrap:
> 
> --- email_raw.tag.orig  Wed May  5 06:53:36 2004
> +++ email_raw.tag       Fri Apr 29 15:33:57 2005
> @@ -30,12 +30,25 @@
>      $body =~ s/^\s+//;
> 
>      SEND: {
> -        open(Vend::MAIL,"|$Vend::Cfg->{SendMailProgram} -t") or last SEND;
> -        print Vend::MAIL $body
> -            or last SEND;
> -        close Vend::MAIL
> -            or last SEND;
> -        $ok = ($? == 0);
> +        my $using = $Vend::Cfg->{SendMailProgram};
> +
> +        if (lc $using eq 'none') {
> +               $ok = 1;
> +               last SEND;
> +       } elsif (lc $using eq 'net::smtp') {
> +               $body =~ s/^(.+?)(?:\r?\n){2}//s;
> +               my $headers = $1;
> +               last SEND unless $headers;
> +               my @head = split(/\r?\n/,$headers);
> +               $ok = send_mail(suppressed,$body);
> +       } else {
> +               open(Vend::MAIL,"|$using -t") or last SEND;
> +               print Vend::MAIL $body
> +                   or last SEND;
> +               close Vend::MAIL
> +                   or last SEND;
> +               $ok = ($? == 0);
> +       }
>      }
> 
>      if (!$ok) {
> _______________________________________________
> interchange-users mailing list
> suppressed
> http://www.icdevgroup.org/mailman/listinfo/interchange-users
> 

-- 
Mike Heins
Perusion -- Expert Interchange Consulting    http://www.perusion.com/
phone +1.765.647.1295  tollfree 800-949-1889 <suppressed>

"All you need in this life is ignorance and confidence, and
then success is sure." -- Mark Twain
_______________________________________________
interchange-users mailing list
suppressed
http://www.icdevgroup.org/mailman/listinfo/interchange-users


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.