[ic] email-raw usertag broken for Net::SMTP FIX
Mike Heins
mike at perusion.com
Sat Apr 30 10:50:23 EDT 2005
Quoting Peter (peter at pajamian.dhs.org):
> 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(\@head,$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
> interchange-users at icdevgroup.org
> 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 <mike at perusion.com>
"All you need in this life is ignorance and confidence, and
then success is sure." -- Mark Twain
More information about the interchange-users
mailing list